﻿var xxEvents = ('ontouchstart' in window) ? {
    start: 'touchstart',
    move: 'touchmove',
    end: 'touchend'
} : {
    start: 'mousedown',
    move: 'mousemove',
    end: 'mouseup'
};
var _ll = _ll || {};
_ll.bgMp3 = function () {
    //背景音乐
    var btn = $('#js_musicBtn'),
        oMedia = $('#media')[0];
    btn.on(xxEvents.start, function (e) {
        if (oMedia.paused) {
            oMedia.play();
        } else {
            oMedia.pause();
        }
        e.preventDefault();
    });
    oMedia.load();
    oMedia.play();
    if (oMedia.paused) {
        $('#wrapper').one(xxEvents.start, function (e) {
            oMedia.play();
            e.preventDefault();
        });
    };
    $(oMedia).on('play', function () {
        btn.addClass('musicPlay');
    });
    $(oMedia).on('pause', function () {
        btn.removeClass('musicPlay');
    });
};
(function ($) {
    var defaults = {
        classIn: 'moveIn',
        classOut: 'moveOut',
        onClass: 'page-on',
        complete: function () {}
        // CALLBACKS
    };
    $.fn.moveIn = function (options) {
        var options = $.extend({}, defaults, options);
        this.addClass(options.classIn).show();
        this.one('webkitAnimationEnd', function () {
            $(this).removeClass(options.classIn).addClass(options.onClass);
            options.complete();
        });
        return this;
    }
    $.fn.moveOut = function (options) {
        var options = $.extend({}, defaults, options);
        this.addClass(options.classOut).show();
        this.one('webkitAnimationEnd', function () {
            $(this).removeClass(options.classOut + ' ' + options.onClass).hide();
            options.complete();
        });
        return this;
    }
})(jQuery);
_ll.hint = function (text) {
    //提示层
    var box = $('#js_hint');
    box.html(text).moveIn();
    if (box[0].timer) {
        clearTimeout(box[0].timer);
    }
    box[0].timer = setTimeout(function () {
        box.moveOut();
    }, 2000);
}
_ll.delayImg = function () {
    var aImg = $('img[_src0]');
    var _length = aImg.length;
    for (var i = 0; i < _length; i++) {
        aImg[i].src = aImg.eq(i).attr('_src0');
    }
}
_ll.tool = {
    getQueryString: function (name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return decodeURIComponent(r[2]);
        return null;
    },
    boolean: function () {
        //随机布尔值
        return (Math.pow(-1, Math.ceil(Math.random() * 1000)) == 1);
    },
    RandomNumBoth: function (Min, Max) {
        var Range = Max - Min;
        var Rand = Math.random();
        var num = Min + Math.round(Rand * Range); //四舍五入
        this.num = num;
        return this.num;
    },
    MyLocalStorage: {
        put: function (key, stringVal, time) {
            try {
                if (!localStorage) {
                    return false;
                }
                if (!time || isNaN(time)) {
                    time = 60;
                }
                var cacheExpireDate = (new Date() - 1) + time * 1000;
                var cacheVal = {
                    val: stringVal,
                    exp: cacheExpireDate
                };
                localStorage.setItem(key, JSON.stringify(cacheVal)); //存入缓存值
            } catch (e) {}
        },
        /**获取缓存*/
        get: function (key) {
            try {
                if (!localStorage) {
                    return false;
                }
                var cacheVal = localStorage.getItem(key);
                var result = JSON.parse(cacheVal);
                var now = new Date() - 1;
                if (!result) {
                    return null;
                } //缓存不存在
                if (now > result.exp) { //缓存过期
                    this.remove(key);
                    return "";
                }

                return result.val;
            } catch (e) {
                this.remove(key);
                return null;
            }
        },
        remove: function (key) {
            if (!localStorage) {
                return false;
            }
            localStorage.removeItem(key);
        },
        /**清空所有缓存*/
        clear: function () {
            if (!localStorage) {
                return false;
            }
            localStorage.clear();
        }
    }
};

/**
 * _s 全局变量
 * Ss 作用域全局变量
 * SS 构造函数
 * oSs createjs 对象
 * 顶级变量按照功能命名
 * 子级变量由繁到简d(data) e(event) len(length)
 */
var _g = {
    abPath: "", //图片绝对路径前缀
    isUser: 1, //是否识别成功 1：成功   0：失败
    money: 88.8, //红包金额
    isGetMoney: 0, //是否已领取红包 1：已领取   0：没
    lhbGl: 0, //老虎机概率
    gameLv: [0, 0, 0, 0], //是否已经进入改关卡
    vBox: [ //视频
        'media/v_1.mp4',
        'media/v_2.mp4',
        'media/v_3.mp4',
        'media/v_4.mp4',
    ],
    pts4: true //p4页提示

};;
(function () {
    //基本数据(本作用域全局变量)
    var D = {
        radius: null //圆形包围页面的半径
    };
    //###舞台相关
    var Canvas = $('#xCanvas')[0];
    var Stage;
    var View = {};

    function Size() {
        //计算画布尺寸
        View.w = 750;
        View.h = 1220;
        View.vh = View.w / $(window).width() * $(window).height();
        if (View.vh > View.h) View.vh = View.h;
        D.radius = Math.sqrt(Math.pow(View.w, 2) + Math.pow(View.h, 2)) / 2;
        //边界
        View.topY = (View.h - View.vh) / 2;
        View.bottomY = View.vh + View.topY;
    }

    function Tick(e) {
        Stage.update(e);
    }

    var wfMusic;
    //###资源
    var Res, Reqs,
        LoadIng = function (progress) {}; //会被load页面重写
    function Load(complete) {
        var basePath = "";
        var manifest = [{
                id: 'loading',
                src: _g.abPath + 'img/loading.png'
            },
            //p1
            {
                id: 'men',
                src: _g.abPath + 'img/men.png'
            },
            {
                id: 'bg_1',
                src: _g.abPath + 'img/bg_1.jpg'
            },
            {
                id: 'dalou',
                src: _g.abPath + 'img/dalou.png'
            },
            {
                id: 'p1_qq',
                src: _g.abPath + 'img/p1_qq.png'
            },
            {
                id: 'wld',
                src: _g.abPath + 'img/wld.png'
            },
            {
                id: 'louc',
                src: _g.abPath + 'img/louc.png'
            },
            {
                id: 'remqun',
                src: _g.abPath + 'img/remqun.png'
            },
            {
                id: 'yun',
                src: _g.abPath + 'img/yun.png'
            },
            {
                id: 'hbleft',
                src: _g.abPath + 'img/hbleft.png'
            },
            {
                id: 'hbright',
                src: _g.abPath + 'img/hbright.png'
            },
            {
                id: 'p1_box',
                src: _g.abPath + 'img/p1_box.png'
            },
            {
                id: 'car',
                src: _g.abPath + 'img/car.png'
            },
            {
                id: 'jeep',
                src: _g.abPath + 'img/jeep.png'
            },
            {
                id: 'pop',
                src: _g.abPath + 'img/pop.png'
            },

            //p2
            {
                id: 'bg_2',
                src: _g.abPath + 'img/bg_2.jpg'
            },
            {
                id: 'p2_qq',
                src: _g.abPath + 'img/p2_qq.png'
            },
            {
                id: 'p2_desk',
                src: _g.abPath + 'img/p2_desk.png'
            },
            {
                id: 'p2_bear',
                src: _g.abPath + 'img/p2_bear.png'
            },
            {
                id: 'cebi',
                src: _g.abPath + 'img/cebi.jpg'
            },

            //3
            {
                id: 'bg_3',
                src: _g.abPath + 'img/bg_3.jpg?v=2.0'
            },
            {
                id: 'discern',
                src: _g.abPath + 'img/discern.jpg?v=2.0'
            },
            {
                id: 'stext',
                src: _g.abPath + 'img/stext.png'
            },
            {
                id: 'qx',
                src: _g.abPath + 'img/qx.png'
            },

            {
                id: 'sb_last',
                src: _g.abPath + 'img/sb_last.png'
            },
            {
                id: 'sb_succ',
                src: _g.abPath + 'img/sb_succ.png'
            },
            {
                id: 'sb_wg',
                src: _g.abPath + 'img/sb_wg.png'
            },

            {
                id: 'sberr',
                src: _g.abPath + 'img/sberr.jpg'
            },

            //4
            {
                id: 'bg_4',
                src: _g.abPath + 'img/bg_4.jpg'
            },
            {
                id: 'p4_ts',
                src: _g.abPath + 'img/p4_ts.png?v=3.0'
            },
            {
                id: 'p4_jtx',
                src: _g.abPath + 'img/p4_jtx.png?v=2.0'
            },



            //5
            {
                id: 'game_bg_h',
                src: _g.abPath + 'img/game_bg_h.png'
            },
            {
                id: 'game_bg_1',
                src: _g.abPath + 'img/game_bg_1.jpg?v=2.0'
            },
            {
                id: 'tmwk',
                src: _g.abPath + 'img/tmwk.png'
            },
            {
                id: 'tmbtn_1',
                src: _g.abPath + 'img/tmbtn_1.png'
            },
            {
                id: 'tmbtn_2',
                src: _g.abPath + 'img/tmbtn_2.png'
            },
            {
                id: 'hx',
                src: _g.abPath + 'img/hx.png'
            },
            {
                id: 'game_succ_1',
                src: _g.abPath + 'img/game_succ_1.png'
            },
            {
                id: 'succ_ys',
                src: _g.abPath + 'img/succ_ys.png'
            },

            {
                id: 'zhbBtn',
                src: _g.abPath + 'img/zhbBtn.png'
            },
            {
                id: 'pnBtn',
                src: _g.abPath + 'img/pnBtn.png'
            },

            {
                id: 'dtBtn',
                src: _g.abPath + 'img/dtBtn.png?v=2.0'
            },
            {
                id: 'p5_bird',
                src: _g.abPath + 'img/p5_bird.png'
            },
            {
                id: 'p5_brid_sb',
                src: _g.abPath + 'img/p5_brid_sb.png'
            },

            //6
            {
                id: 'game_bg_2',
                src: _g.abPath + 'img/game_bg_2.jpg?v=3.0'
            },
            {
                id: 'tmwk_2',
                src: _g.abPath + 'img/tmwk_2.png'
            },
            {
                id: 'game2Btn_1',
                src: _g.abPath + 'img/game2Btn_1.png'
            },
            {
                id: 'game2Btn_2',
                src: _g.abPath + 'img/game2Btn_2.png'
            },
            {
                id: 'hbjb',
                src: _g.abPath + 'img/hbjb.png'
            },
            {
                id: 'zd',
                src: _g.abPath + 'img/zd.png'
            },
            {
                id: 'sxion',
                src: _g.abPath + 'img/sxion.png'
            },
            {
                id: 'nlt',
                src: _g.abPath + 'img/nlt.png'
            },
            {
                id: 'succ_ys_3',
                src: _g.abPath + 'img/succ_ys_3.png'
            },

            {
                id: 'jdtn',
                src: _g.abPath + 'img/jdtn.jpg'
            },
            {
                id: 'p6_ts',
                src: _g.abPath + 'img/p6_ts.png'
            },


            // 7
            {
                id: 'game_bg_3',
                src: _g.abPath + 'img/game_bg_3.jpg?v=3.0'
            },
            {
                id: 'tmwk_3',
                src: _g.abPath + 'img/tmwk_3.png?v=2.0'
            },
            {
                id: 'gl_1',
                src: _g.abPath + 'img/gl_1.png'
            },
            {
                id: 'gl_2',
                src: _g.abPath + 'img/gl_2.png'
            },
            {
                id: 'send_1',
                src: _g.abPath + 'img/send_1.png'
            },
            {
                id: 'send_2',
                src: _g.abPath + 'img/send_2.png'
            },
            {
                id: 'bird',
                src: _g.abPath + 'img/bird.png'
            },
            {
                id: 'laba',
                src: _g.abPath + 'img/laba.png'
            },
            {
                id: 'qqmicu',
                src: _g.abPath + 'img/qqmicu.png'
            },
            {
                id: 'yf',
                src: _g.abPath + 'img/yf.png'
            },
            {
                id: 'succ_ys_2',
                src: _g.abPath + 'img/succ_ys_2.png'
            },

            //8
            {
                id: 'game_bg_4',
                src: _g.abPath + 'img/game_bg_4.jpg?v=3.0'
            },
            {
                id: 'tmwk_4',
                src: _g.abPath + 'img/tmwk_4.png'
            },
            {
                id: 'p8_dd',
                src: _g.abPath + 'img/p8_dd.png'
            },
            {
                id: 'p8_hb',
                src: _g.abPath + 'img/p8_hb.png'
            },
            {
                id: 'succ_ys_4',
                src: _g.abPath + 'img/succ_ys_4.png'
            },


            //老虎机
            {
                id: 'lhj_i',
                src: _g.abPath + 'img/lhj_i.png'
            },
            //end


            //9
            {
                id: 'bg_9',
                src: _g.abPath + 'img/bg_9.jpg'
            },

            {
                id: 'p9_ren_1',
                src: _g.abPath + 'img/p9_ren_1.png?v=2.0'
            },
            {
                id: 'p9_ren_2',
                src: _g.abPath + 'img/p9_ren_2.png?v=2.0'
            },
            {
                id: 'p9_ren_3',
                src: _g.abPath + 'img/p9_ren_3.png?v=2.0'
            },
            {
                id: 'p9_ren_4',
                src: _g.abPath + 'img/p9_ren_4.png?v=2.0'
            },
            {
                id: 'p9_ren_5',
                src: _g.abPath + 'img/p9_ren_5.png?v=2.0'
            },
            {
                id: 'p9_bottom',
                src: _g.abPath + 'img/p9_bottom.png'
            },


            //10
            {
                id: 'bg_10',
                src: _g.abPath + 'img/bg_10.jpg'
            },
            {
                id: 'shareBtn',
                src: _g.abPath + 'img/shareBtn.png'
            },
            {
                id: 'jxBtn',
                src: _g.abPath + 'img/jxBtn.png'
            },


            {
                id: 'dtBtn_on',
                src: _g.abPath + 'img/dtBtn_on.png'
            },

            {
                id: 'game_bg_dh1',
                src: _g.abPath + 'img/game_bg_dh1.png'
            },
            {
                id: 'game_bg_dh2',
                src: _g.abPath + 'img/game_bg_dh2.png'
            },
            {
                id: 'game_bg_dh3',
                src: _g.abPath + 'img/game_bg_dh3.png'
            },
            {
                id: 'game_bg_dh4',
                src: _g.abPath + 'img/game_bg_dh4.png'
            },
            {
                id: 'sharets',
                src: _g.abPath + 'img/sharets.png'
            },
            {
                id: 'p9_btn',
                src: _g.abPath + 'img/p9_btn.png'
            },

            {
                id: 'vgameerr',
                src: _g.abPath + 'img/vgameerr.png'
            },

            {
                id: 'xerr',
                src: _g.abPath + 'img/xerr.png'
            },
            {
                id: 'xSm',
                src: _g.abPath + 'img/xSm.png'
            },
            {
                id: 'cErr',
                src: _g.abPath + 'img/cErr.png'
            },

            {
                id: 'v_q_1',
                src: _g.abPath + 'img/v_q_1.jpg'
            },
            {
                id: 'v_q_2',
                src: _g.abPath + 'img/v_q_2.jpg'
            },
            {
                id: 'v_q_3',
                src: _g.abPath + 'img/v_q_3.jpg'
            },
            {
                id: 'v_q_4',
                src: _g.abPath + 'img/v_q_4.jpg'
            },


            {
                id: 'btn_an_1',
                src: _g.abPath + 'img/btn_an_1.png'
            },
            {
                id: 'btn_an_2',
                src: _g.abPath + 'img/btn_an_2.png'
            },
            {
                id: 'btn_an_3',
                src: _g.abPath + 'img/btn_an_3.png'
            },
            {
                id: 'btn_an_4',
                src: _g.abPath + 'img/btn_an_4.png'
            },
            {
                id: 'fag',
                src: _g.abPath + 'img/fag.png'
            },

            {
                id: 'p4_an_1',
                src: _g.abPath + 'img/p4_an_1.png'
            },
            {
                id: 'p4_an_2',
                src: _g.abPath + 'img/p4_an_2.png'
            },
            {
                id: 'p4_an_3',
                src: _g.abPath + 'img/p4_an_3.png'
            },
            {
                id: 'p4_an_4',
                src: _g.abPath + 'img/p4_an_4.png'
            },
            {
                id: 'p7_da_1',
                src: _g.abPath + 'img/p7_da_1.png'
            },
            {
                id: 'p7_da_2',
                src: _g.abPath + 'img/p7_da_2.png'
            },

            {
                id: 'p3_gqx',
                src: _g.abPath + 'img/p3_gqx.png'
            },

            {
                id: 'p3_jt',
                src: _g.abPath + 'img/p3_jt.png'
            },

            {
                id: 'p4_btnlx',
                src: _g.abPath + 'img/p4_btnlx.png'
            }
        ];
        //加载DOM文件
        var DOMImg = $('img[_src]');
        for (var i = 0; i < DOMImg.length; i++) {
            manifest.push(_g.abPath + DOMImg.eq(i).attr('_src'));
        }

        Res = new createjs.LoadQueue(false, basePath, 'anonymous');
        Res.on("complete", handleComplete, this);
        Res.on("progress", handleProgress, this);
        // 音频
        // //####事件
        var sounds = [{
                src: _g.abPath + "media/tm.mp3",
                id: "tm",
                data: 1
            },
            {
                src: _g.abPath + "media/wufu.mp3?v=1",
                id: "wufu",
                data: 1
            },
        ];
        createjs.Sound.alternateExtensions = ["mp3"];
        createjs.Sound.registerSounds(sounds);
        if (createjs.WebAudioPlugin) {
            $(window).one('touchstart', function () {
                createjs.WebAudioPlugin.playEmptySound();
            });
        }

        Res.loadManifest(manifest);
        Res.setMaxConnections(10);
        Res.load();

        function handleComplete() {
            var DOMImg = $('img[_src]');
            for (var i = 0; i < DOMImg.length; i++) {
                DOMImg[i].src = _g.abPath + DOMImg.eq(i).attr('_src');
            }
            //_ll.mp3=_ll.bgMp3();
            setTimeout(function () {
                complete();
            }, 700);
        }

        function handleProgress(e) {
            var progress = e.progress;
            if (progress > 1) progress = 1;
            LoadIng(progress);
        }
    }

    //公共元素
    var E = {};
    //创建
    var Create = {
        cimg: function (id) {
            //基点居中图片
            var img = Res.getResult(id);
            var o = new createjs.Bitmap(img);
            o.set({
                regX: img.width / 2,
                regY: img.height / 2
            });
            return o;
        },
        hitArea: function (o, w, h, scale) {
            //设置感应区域
            var scale = scale || 1;
            var hitArea = new createjs.Shape();
            hitArea.graphics.f('#000').dr(0, 0, w, h);
            var cx = w / 2,
                cy = h / 2;
            hitArea.set({
                scaleX: scale,
                scaleY: scale,
                regX: cx,
                regY: cy,
                x: cx,
                y: cy
            });
            o.hitArea = hitArea;
        },
        btn: function (id, scale) {
            //按钮
            var scale = scale || 1;
            var o = this.cimg(id);
            this.hitArea(o, o.image.width, o.image.height, scale);
            return o;
        },
        domHitArea: function (o) {
            //创建dom热点
            //o与屏幕中心点的距离
            //单位rem
            var x = (o.x - o.regX - W / 2) / 100,
                y = (o.y - o.regY - H / 2) / 100,
                w = o.image.width / 100,
                h = o.image.height / 100;
            var $o = $('<span></span>');
            $o.css({
                width: w + 'rem',
                height: h + 'rem',
                position: 'absolute',
                zIndex: '2500',
                left: '50%',
                top: '50%',
                margin: y + 'rem 0 0 ' + x + 'rem',
            });
            $('body').append($o);
            return $o;
        }
    }

    //动画
    var Tween = {
        zoomIn: function (o, complete) {
            o.set({
                scaleX: 1.4,
                scaleY: 1.4,
                alpha: 0
            });
            createjs.Tween.get(o)
                .to({
                    alpha: 1,
                    scaleX: 1,
                    scaleY: 1
                }, 500, createjs.Ease.backOut)
                .call(function () {
                    if (complete) complete();
                });
        },
        zoomOut: function (o, complete) {
            createjs.Tween.get(o, {
                    override: true
                })
                .to({
                    alpha: 0,
                    scaleX: 1.4,
                    scaleY: 1.4
                }, 500, createjs.Ease.quartOut)
                .call(function () {
                    if (complete) complete(this);
                    if (this.parent) this.parent.removeChild(this);
                });
        },
        btnIn: function (o, delay) {
            o.set({
                scaleX: 0.5,
                scaleY: 0.5,
                alpha: 0
            });
            createjs.Tween.get(o)
                .wait(delay)
                .to({
                    scaleX: 1,
                    scaleY: 1,
                    alpha: 1
                }, 1500, createjs.Ease.elasticOut);
        },
        click: function (o) {
            var ix = o.x,
                iy = o.y;
            o.set({
                x: ix + 20,
                y: iy + 20
            });
            createjs.Tween.get(o, {
                    loop: true
                })
                .to({
                    x: ix,
                    y: iy
                }, 500)
                .to({
                    x: ix + 20,
                    y: iy + 20
                }, 500);
        }
    };

    //模块功能
    var Fn = {
        //loading页图片预加载
        loadingImg: function (complete) {
            var basePath = "";
            var loadingData = [{
                    id: 'ren_1',
                    src: _g.abPath + 'img/ren_1.png?v=2.0'
                },
                {
                    id: 'ren_2',
                    src: _g.abPath + 'img/ren_2.png?v=2.0'
                },
                {
                    id: 'ren_3',
                    src: _g.abPath + 'img/ren_3.png?v=2.0'
                },
                {
                    id: 'ren_4',
                    src: _g.abPath + 'img/ren_4.png?v=2.0'
                },
                {
                    id: 'ren_5',
                    src: _g.abPath + 'img/ren_5.png?v=2.0'
                },
                {
                    id: 'ren_6',
                    src: _g.abPath + 'img/ren_6.png?v=2.0'
                },
                {
                    id: 'loadbtn',
                    src: _g.abPath + 'img/loadbtn.png'
                },
                {
                    id: 'jd',
                    src: _g.abPath + 'img/jd.jpg'
                },

            ];
            Reqs = new createjs.LoadQueue(false, basePath, 'anonymous');
            Reqs.on("complete", loadingComplete, this);
            Reqs.loadManifest(loadingData);
            Reqs.setMaxConnections(10);
            Reqs.load();

            function loadingComplete() {
                complete();
            }
        },
        //成功事件
        succAnime: function (gameCon, page, succYsObj) {

            var obj = {};
            //回答成功的容器
            var gameSuccCon = new createjs.Container();
            gameCon.addChild(gameSuccCon);
            //覆盖层
            var oHx = Create.cimg("hx");
            oHx.set({
                x: 375,
                y: 692.5
            });
            var oGameSucc = Create.cimg("game_succ_1");
            oGameSucc.set({
                x: 375,
                y: 627
            });
            var h = 39;
            var oGameSuccTop = new createjs.Rectangle(0, 0, 277, h);
            oGameSucc.sourceRect = oGameSuccTop;
            var oGameSuccBotton = Create.cimg("game_succ_1");
            oGameSuccBotton.set({
                x: 375,
                y: 665
            });
            var h = 39;
            var oGameSuccTop2 = new createjs.Rectangle(0, 480, 277, 39);
            oGameSuccBotton.sourceRect = oGameSuccTop2;
            gameSuccCon.addChild(oHx, oGameSucc, oGameSuccBotton);

            //添加元素
            function addYs() {

                //饰品元素
                var oYs = Create.cimg(succYsObj.name);
                oYs.set({
                    regY: 0
                })
                oYs.set({
                    x: succYsObj.x || 383,
                    y: succYsObj.y || 300.5,
                    alpha: 0
                });
                createjs.Tween.get(oYs)
                    .to({
                        alpha: 1
                    }, 800, createjs.Ease.quadOut)

                createjs.Tween.get(oYs, {
                        loop: true
                    })
                    .wait(300)
                    .to({
                        scaleY: 1.05,
                        scaleX: 1.05
                    }, 1000, createjs.Ease.linear)
                    .to({
                        scaleY: 1,
                        scaleX: 1
                    }, 1000, createjs.Ease.linear);

                //拆红包按钮
                var oBtns1 = Create.cimg("zhbBtn");
                oBtns1.set({
                    x: 250,
                    y: 1024,
                    alpha: 0
                });
                //继续拜年按钮
                var oBtns2 = Create.cimg("pnBtn");
                oBtns2.set({
                    x: 500,
                    y: 1024,
                    alpha: 0
                });

                oBtns1.set({
                    x: oBtns1.x - 50
                });
                oBtns2.set({
                    x: oBtns2.x + 50
                });
                createjs.Tween.get(oBtns1)
                    .to({
                        x: oBtns1.x + 50,
                        alpha: 1
                    }, 800, createjs.Ease.quadOut)
                createjs.Tween.get(oBtns2)
                    .to({
                        x: oBtns2.x - 50,
                        alpha: 1
                    }, 800, createjs.Ease.quadOut)
                gameSuccCon.addChild(oYs, oBtns1, oBtns2);

                var btnStrar = true;
                //事件
                oBtns1.on("click", function () {
                    if (!btnStrar) return;
                    btnStrar = false;
                    //跳到即五福齐聚页面
                    Fn.callBx();
                    createjs.Tween.get(oBtns1)
                        .to({
                            scaleX: 0.8,
                            scaleY: 0.8
                        }, 100, createjs.Ease.quadOut)
                        .to({
                            scaleX: 1,
                            scaleY: 1
                        }, 100, createjs.Ease.quadOut)
                });
                oBtns2.on("click", function () {
                    if (!btnStrar) return;
                    btnStrar = false;
                    createjs.Tween.get(oBtns2)
                        .to({
                            scaleX: 0.8,
                            scaleY: 0.8
                        }, 100, createjs.Ease.quadOut)
                        .to({
                            scaleX: 1,
                            scaleY: 1
                        }, 100, createjs.Ease.quadOut)

                    //出现电梯按钮
                    createjs.Tween.get(gameCon)
                        .to({
                            scaleY: 1.5,
                            scaleX: 1.5,
                            alpha: 0
                        }, 800, createjs.Ease.quadOut);


                    Fn.dtBtnShow(page);
                });

            }


            obj.init = function () {
                gameSuccCon.alpha = 0;
                h = 39;
                oGameSuccBotton.y = 665;
            };

            //开始动画
            obj.start = function () {
                createjs.Tween.get(gameSuccCon)
                    .to({
                        alpha: 1
                    }, 600, createjs.Ease.quadOut)
                    .call(function () {
                        function run() {
                            h += 8;
                            var oGameSuccTop = new createjs.Rectangle(0, 0, 277, h);
                            oGameSucc.sourceRect = oGameSuccTop;
                            oGameSuccBotton.y = oGameSuccBotton.y + 8;

                            if (h >= 478) {
                                gameSuccCon.removeEventListener("tick", run);
                                addYs();

                            }
                        }

                        gameSuccCon.addEventListener("tick", run);
                    });

            };

            obj.init();

            return obj;
        },
        //电梯按钮
        dtBtnShow: function (page) {

            var dtCon = new createjs.Container();
            dtCon.set({
                x: 200,
                alpha: 0
            });
            var oDtBtn = Create.cimg("dtBtn");
            oDtBtn.set({
                x: 644.5,
                y: 615,
            });
            var oBtnOn = Create.cimg("dtBtn_on");

            oBtnOn.set({
                x: 630.5,
                y: 372.5,
                alpha: 0
            });
            createjs.Tween.get(dtCon)
                .to({
                    x: 0,
                    alpha: 1
                }, 800, createjs.Ease.quadOut)
                .call(function () {
                    createjs.Tween.get(oBtnOn, {
                            loop: true
                        })
                        .to({
                            alpha: 1
                        }, 100, createjs.Ease.quadOut)
                        .to({
                            alpha: 0
                        }, 100, createjs.Ease.quadOut)
                });


            var oBtnAn1 = Create.cimg("btn_an_1");
            oBtnAn1.set({
                x: 630.5,
                y: 498,
                alpha: 0
            });
            var oBtnAn2 = Create.cimg("btn_an_2");
            oBtnAn2.set({
                x: 630.5,
                y: 622,
                alpha: 0
            });
            var oBtnAn3 = Create.cimg("btn_an_3");
            oBtnAn3.set({
                x: 630.5,
                y: 745,
                alpha: 0
            });
            var oBtnAn4 = Create.cimg("btn_an_4");
            oBtnAn4.set({
                x: 630.5,
                y: 870,
                alpha: 0
            });
            _g.gameLv.forEach(function (val, i) {
                if (val === 1) {
                    switch (i) {
                        case 0:
                            oBtnAn1.alpha = 1;
                            break;
                        case 1:
                            oBtnAn2.alpha = 1;
                            break;
                        case 2:
                            oBtnAn3.alpha = 1;
                            break;
                        case 3:
                            oBtnAn4.alpha = 1;
                            break;
                    }
                }
            });


            //福
            var obtn1 = new createjs.Shape();
            obtn1.graphics.f('#000').dr(580, 320, 100, 100);
            obtn1.alpha = 0.01;
            //禄
            var obtn2 = new createjs.Shape();
            obtn2.graphics.f('#000').dr(580, 450, 100, 100);
            obtn2.alpha = 0.01;
            //寿
            var obtn3 = new createjs.Shape();
            obtn3.graphics.f('#000').dr(580, 570, 100, 100);
            obtn3.alpha = 0.01;
            //喜
            var obtn4 = new createjs.Shape();
            obtn4.graphics.f('#000').dr(580, 700, 100, 100);
            obtn4.alpha = 0.01;
            //财
            var obtn5 = new createjs.Shape();
            obtn5.graphics.f('#000').dr(580, 820, 100, 100);
            obtn5.alpha = 0.01;
            page.addChild(dtCon);
            dtCon.addChild(oDtBtn, oBtnOn, oBtnAn1, oBtnAn2, oBtnAn3, oBtnAn4, obtn1, obtn2, obtn3, obtn4, obtn5);

            obtn1.on("click", function () {
                Fn.callBx();
            });
            obtn2.on("click", function () {
                Page.to("p5");
            });
            obtn3.on("click", function () {
                Page.to("p6");
            });
            obtn4.on("click", function () {
                Page.to("p7");
            });
            obtn5.on("click", function () {
                Page.to("p8");
            });

        },
        //老虎机
        lhj: function () {
            var obj = {};
            obj.lhjCon = new createjs.Container();
            var gH = 110; //没小格高度
            var mwX = 202; //限制容器的位置x
            var mwY = 348; //限制容器的位置y
            var limit = true; //状态

            //只显示mwMask内的内容    滚动内容放在mWarp容器里
            var mwMask = new createjs.Shape();
            mwMask.graphics.dr(mwX, mwY, 350, 250);
            var mWarp = new createjs.Container();
            mWarp.set({
                x: mwX,
                y: mwY
            });
            mWarp.mask = mwMask;

            var csY = -40; //初始位置 y
            //滚动内容
            var rowAtr = []; //滚动的容器
            //滚动的一列
            for (var j = 0; j < 3; j++) {
                var conRow = new createjs.Container();

                if (j === 0) {
                    conRow.x = 15;
                }
                if (j === 1) {
                    conRow.x = 135;
                }
                if (j === 2) {
                    conRow.x = 255;
                }
                conRow.set({
                    y: 0
                });
                for (var i = 0; i < 20; i++) {
                    var ogun = new createjs.Bitmap(Res.getResult("lhj_i"));
                    ogun.set({
                        x: 0,
                        y: ogun.image.height * i + csY - gH * j,
                    });
                    conRow.addChild(ogun);
                }
                mWarp.addChild(conRow);
                rowAtr.push(conRow);
            }

            obj.lhjCon.addChild(mWarp);
            obj.init = function () {
                rowAtr.forEach(function (val, i) {
                    rowAtr[i].set({
                        y: 0
                    })
                });
            }
            //启动
            obj.start = function (complete) {
                if (!limit) return;
                limit = false;
                var isNot = 0; //中奖是1  不中是0
                var tur1 = 0,
                    tur2 = 0,
                    tur3 = 0;
                if (_g.lhbGl == 0) {
                    //第一次必失败
                    turns = 47; //圈数
                    tur1 = turns,
                        tur2 = turns + 1,
                        tur3 = turns + 2;
                    isNot = 0;
                    _g.lhbGl = 1;
                } else if (_g.lhbGl == 1) {
                    //第二次必中
                    //中的圈数
                    tur1 = 45,
                        tur2 = 45 - 1,
                        tur3 = 45 - 2;
                    isNot = 1;
                    _g.lhbGl = 2;
                } else if (_g.lhbGl == 2) {
                    //90%  后面的概率

                    var isZh = _ll.tool.RandomNumBoth(0, 10); //>5中  <不中

                    if (isZh >= 1) {
                        //中的圈数
                        tur1 = 45,
                            tur2 = 45 - 1,
                            tur3 = 45 - 2;
                        isNot = 1;
                    } else {
                        var turns = _ll.tool.RandomNumBoth(40, 50); //圈数
                        tur1 = turns,
                            tur2 = turns + 1,
                            tur3 = turns + 2;
                        isNot = 0;

                        if (turns % 3 == 0) {
                            turns = 47; //圈数
                            tur1 = turns,
                                tur2 = turns + 1,
                                tur3 = turns + 2;
                            isNot = 0;
                        }
                    }
                }
                createjs.Tween.get(rowAtr[0])
                    .to({
                        y: -gH * tur1
                    }, 4000, createjs.Ease.quadInOut);
                createjs.Tween.get(rowAtr[1])
                    .wait(200)
                    .to({
                        y: -gH * tur2
                    }, 4000, createjs.Ease.quadInOut);
                createjs.Tween.get(rowAtr[2])
                    .wait(400)
                    .to({
                        y: -gH * tur3
                    }, 4000, createjs.Ease.quadInOut)
                    .call(function () {
                        limit = true;
                        if (complete) complete(isNot);
                    })
            }
            obj.init();
            return obj;

        },
        //封装帧动画动画对象
        CreateAniFame: function (data) {
            var spriteSheet = new createjs.SpriteSheet(data),
                FrameAnimation = new createjs.Sprite(spriteSheet, "start"); //开始就执行 定义的dance动画
            //动画结束事件
            FrameAnimation.on('animationend', function () {

            });

            //播放帧动画
            function gotoAndPlay(name) {}

            return FrameAnimation;
        },
        videoLoad: function (attr) {
            attr.forEach(function (val) {
                var v =  document.createElement("video");
                v.src =val;
                v.load();
            });
        },
        //播放视频
        payVideo: function (i, v, complete) {
            var ua = navigator.userAgent.toLowerCase();
            if (/iphone|ipad|ipod/.test(ua)) {
                //ios
                var html = '<video id="video"  poster="' + _g.abPath + 'img/v_q_' + i + '.jpg" x-webkit-airplay="true" webkit-playsinline="true" playsinline="true" preload="auto" x5-video-player-type="h5" src="' + v + '" airplay="allow"></video>';
                $(".v_lbg").attr("src", _g.abPath + 'img/v_q_' + i + '.jpg').show();
                $("#pVideo").show().append(html);
                $('#video')[0].play();
                $('#video').on('ended', function () {
                    //视频播放结束
                    $(".v_lbg").attr("src", '').hide();
                    setTimeout(function () {
                        $("#pVideo").hide();
                        $("#video").remove();
                        $('#media')[0].play();
                    }, 200)
                });
            }else{
                var html = '<video id="video" class="video"  poster="' + _g.abPath + 'img/v_q_' + i + '.jpg" x-webkit-airplay="true" webkit-playsinline="true" playsinline="true" preload="auto" x5-video-player-type="h5" src="' + v + '" airplay="allow"></video>';
                $(".v_lbg").attr("src", _g.abPath + 'img/v_q_' + i + '.jpg').show();
                $("#pVideo").show().append(html);
                $('#video')[0].play();
                $('#video').on('ended', function () {
                    //视频播放结束
                    $(".v_lbg").attr("src", '').hide();
                    setTimeout(function () {
                        $("#pVideo").hide();
                        $("#video").remove();
                        $('#media')[0].play();
                    }, 200)
                });
    
                $("#video")[0].oncanplaythrough = function () {
                    setTimeout(function () {
                        $("#video").addClass("video_ON")
                    }, 800)
                }
            }
            setTimeout(function () {
                if (complete) complete();
            }, 1000);
        },
        //每页游戏初始化
        gameInit: function (gdObj, bg, dh, page, gameMian) {
            //背景
            var gameBg = new createjs.Bitmap(Res.getResult(bg));

            var oDh = Create.cimg(dh);
            oDh.set({
                x: 366,
                y: 584
            });
            createjs.Tween.get(oDh, {
                    loop: true
                })
                .to({
                    scaleX: 1.1,
                    scaleY: 1.1,
                }, 300, createjs.Ease.quadOut)
                .to({
                    scaleX: 1,
                    scaleY: 1,
                }, 300, createjs.Ease.quadOut);

            var oFg = Create.cimg("fag");

            oFg.set(gdObj);
            createjs.Tween.get(oFg, {
                    loop: true
                })
                .to({
                    alpha: 0
                }, 300, createjs.Ease.quadOut)
                .to({
                    alpha: 1
                }, 300, createjs.Ease.quadOut);
            var oinitBtn = new createjs.Shape();
            oinitBtn.graphics.f('#000').dr(120, 580, 300, 300);
            oinitBtn.alpha = 0.01;
            page.addChild(gameBg, oDh, oFg, oinitBtn);
            var oinStart = true;
            oinitBtn.on("click", function () {
                if (!oinStart) return;
                oinStart = false;
                //黑背景
                var gameBgH = Create.cimg("game_bg_h");
                gameBgH.set({
                    x: View.w / 2,
                    y: View.h / 2,
                    alpha: 0
                });
                page.addChild(gameBgH);
                createjs.Tween.get(gameBgH)
                    .to({
                        alpha: 1,
                    }, 1000, createjs.Ease.quadInOut)
                    .call(function () {
                        gameMian();
                    });
            });
        },

        callBx: function () {
            Fn.reqAjax(function (data) {
                console.log(data)
                _g.money = 100.00;
                Page.to("p9");
            });
        },
        reqAjax: function (callBack) {
            $.ajax({
                type: "POST",
                url: "Common/draw.aspx",
                dataType: "json",
                beforeSend: function () {
                    $("#js_loading").moveIn();
                },
                success: function (data) {
                    if (callBack) callBack(data);
                },
                complete: function () {
                    $("#js_loading").moveOut();
                }
            });
        }


    };

    //公用模块
    var Module = {};
    //###页面
    //页面结构 布局(添加到场景)-动画-功能-out
    var Page = {
        zIndex: 10, //canvas和dom层相互切换
        lastPage: null, //上一个显示的页面
        nowPage: null, //当前显示的页面
        page: function (pid, ptype) {
            //创建页面容器
            var page;
            if (ptype == "dom") {
                page = $('#' + pid);
                page.ptype = "dom";
            } else {
                page = new createjs.Container();
                Stage.addChild(page);
            }
            page.pid = pid;
            this.lastPage = this.nowPage;
            this.nowPage = page;
            return page;
        },
        to: function (pid, complete) {
            //进入pid页面
            if (this.nowPage && this.nowPage.pid == pid) return; //禁止重复跳转页面
            if (Page.lastPage && Page.lastPage.ptype != "dom") {
                createjs.Tween.removeAllTweens(); //清除所有Tween
            };
            this[pid]();
            if (Page.nowPage.ptype == "dom") {
                Page.zIndex++;
                Page.nowPage.css('zIndex', Page.zIndex).show();
                var domLimit = true;
                Page.nowPage.one("webkitAnimationEnd", function () {
                    if (!domLimit) return;
                    domLimit = false;
                    $(this).addClass("page-on");
                    if (Page.lastPage) {
                        if (Page.lastPage.ptype == "dom") {
                            Page.lastPage.removeClass("page-on").hide();
                        } else {
                            createjs.Tween.removeAllTweens();
                            Page.lastPage.tickChildren = false;
                            Stage.removeChild(Page.lastPage);
                            $('#stage').hide();
                        }
                        if (Page.lastPage.out) Page.lastPage.out();
                    }
                    if (complete) complete();
                });
            } else {
                if (Page.lastPage && Page.lastPage.ptype == "dom") {
                    Page.zIndex++;
                    $('#stage').css('zIndex', Page.zIndex).show();
                }
                if (Page.lastPage) {
                    //上个页面退出
                    if (Page.lastPage.out) Page.lastPage.out();
                }
                var mask = new createjs.Shape();
                mask.graphics.dc(0, 0, D.radius);
                mask.set({
                    x: View.w / 2,
                    y: View.h / 2,
                    scaleX: 0,
                    scaleY: 0
                });
                Page.nowPage.mask = mask;
                createjs.Tween.get(mask)
                    .to({
                        scaleX: 1,
                        scaleY: 1
                    }, 500, createjs.Ease.quadOut)
                    .call(function () {
                        //页面切换完成
                        Page.nowPage.mask = null;
                        if (Page.lastPage) {
                            if (Page.lastPage.ptype == "dom") {
                                Page.lastPage.removeClass("page-on").hide();
                            } else {
                                //清除页面tick 防止Sprite＆MovieClip框架持续运行
                                Page.lastPage.tickChildren = false;
                                Stage.removeChild(Page.lastPage);
                            };
                        };
                        if (complete) complete();
                    });
            }
        },
        out: function (complete) {
            //退出页面
            if (page.nowPage.ptype == "dom") {
                page.nowPage.moveOut({
                    complete: function () {
                        page.nowPage.removeClass("page-on").hide();
                        reset();
                        if (complete) complete();
                    }
                });

            } else {

                var mask = new createjs.Shape();
                mask.graphics.dc(0, 0, D.radius);
                ease = createjs.Ease.quadOut;
                mask.set({
                    x: View.w / 2,
                    y: View.h / 2,
                    scaleX: 0,
                    scaleY: 0
                });
                Page.nowPage.mask = mask;
                createjs.Tween.get(mask)
                    .to({
                        scaleX: 1,
                        scaleY: 1
                    }, 500, createjs.Ease.quadOut)
                    .call(function () {
                        //页面切换完成
                        Page.nowPage.mask = null;
                        Page.nowPage.tickChildren = false;
                        createjs.Tween.removeAllTweens();
                        Stage.removeChild(Page.nowPage);
                        reset();
                        if (complete) complete();
                    });
            }

            function reset() {
                page.nowPage = page.lastPage = null;
                page.zIndex = 10;
            }
        },
        load: function () {
            var page = this.page('load');
            //###布局
            var oBg = new createjs.Shape();
            oBg.graphics.f('#ddeefe').dr(0, 0, View.w, View.h);


            //添加到场景
            page.addChild(oBg);


            var renAtr = [{
                    x: 260,
                    y: 403.5,
                    name: "ren_1"
                },
                {
                    x: 286,
                    y: 326.5,
                    name: "ren_2"
                },
                {
                    x: 410,
                    y: 348,
                    name: "ren_3"
                },

                {
                    x: 134,
                    y: 355,
                    name: "ren_4"
                },


                {
                    x: 69,
                    y: 423.5,
                    name: "ren_5"
                },

                {
                    x: 485,
                    y: 403.5,
                    name: "ren_6"
                }

            ];
            var oRenAtr = [];
            renAtr.forEach(function (val) {
                var oRen = new createjs.Bitmap(Reqs.getResult(val.name));
                oRen.set({
                    x: val.x,
                    y: val.y,
                    alpha: 0
                });
                page.addChild(oRen);
                oRenAtr.push(oRen);
            });
            var renUn = 0;
            var nm = 0;

            var sbtnStart = false;

            function run() {
                if (renUn < oRenAtr.length) {
                    createjs.Tween.get(oRenAtr[renUn])
                        .to({
                            alpha: 1
                        }, 100, createjs.Ease.linear);
                    if (renUn >= 7) {
                        nm++;
                        for (var i = 0; i < nm; i++) {
                            oRenAtr[i].alpha = 0.5;
                        }
                    }
                    renUn++;

                } else {
                    if (sbtnStart) {
                        showBtn();
                    }
                }
            }

            var oRenTime = setInterval(run, 800);
            //进度条
            var ojx = 184;
            var ojy = 764;
            var jdWarp = new createjs.Container();
            var oJd = new createjs.Bitmap(Reqs.getResult("jd"));
            oJd.set({
                x: ojx,
                y: ojy,
                scaleX: 0
            });
            var oJdwk = new createjs.Shape();
            oJdwk.graphics.beginStroke('#31bde0').dr(ojx, ojy, 370, 30);
            page.addChild(jdWarp);

            //百分百
            var oText = new createjs.Text("0%", "24px Microsoft YaHei", "#31bde0");
            oText.set({
                textAlign: "center",
                textBaseline: "middle",
                x: 520,
                y: ojy + 15
            });
            var oLoading = new createjs.Text("Loading...", "30px Microsoft YaHei", "#31bde0");
            oLoading.set({
                textAlign: "center",
                textBaseline: "middle",
                x: 380,
                y: ojy + 80
            });
            jdWarp.addChild(oJdwk, oJd, oText, oLoading);
            createjs.Tween.get(oLoading,{loop:true})
            .to({
                alpha: 0
            }, 400, createjs.Ease.quadOut)
            .to({
                alpha:1
            }, 400, createjs.Ease.quadOut); 

            //出现按钮
            function showBtn() {
                clearInterval(oRenTime);
                createjs.Tween.get(jdWarp)
                    .to({
                        alpha: 0
                    }, 400, createjs.Ease.quadOut)
                    .call(function () {
                        var olBtn = new createjs.Bitmap(Reqs.getResult("loadbtn"));
                        olBtn.set({
                            x: 260,
                            y: 868,
                            alpha: 0
                        });
                        page.addChild(olBtn);
                        createjs.Tween.get(olBtn)
                            .to({
                                alpha: 1
                            }, 400, createjs.Ease.quadOut);
                        olBtn.on("click", function () {
                            Page.to('p1');

                            Fn.videoLoad(_g.vBox);

                        });
                    })
            }

            //###动画
            //……

            // //背景

            //###功能
            LoadIng = function (progress) {
                oText.text = Math.round(progress * 100) + '%';
                oJd.scaleX = progress;
                if (progress >= 1) {
                    sbtnStart = true;
                }
            };

            //###out
            page.out = function () {

            }
        },
        //首页
        p1: function () {
            var page = this.page('p1');
            //###布局



            //背景
            var oBg1 = new createjs.Bitmap(Res.getResult("bg_1"));

            var oDlou = new createjs.Bitmap(Res.getResult("dalou"));
            //门
            var oMenData = {
                images: [Res.getResult("men")],
                frames: {
                    width: 31, //每帧的宽度
                    height: 39, //每帧的高度
                    count: 5 //总的帧数
                },
                animations: {
                    start: 0,
                    move0: [0, 4, "stop"], //自定义动画名称
                    stop: 4
                },
                framerate: 10
            };
            var oMen = Fn.CreateAniFame(oMenData);
            oMen.set({
                x: 302,
                y: 730
            });
            //qq
            var oQqData = {
                images: [Res.getResult("p1_qq")],
                frames: {
                    width: 30, //每帧的宽度
                    height: 39, //每帧的高度
                    count: 12 //总的帧数
                },
                animations: {
                    start: 0,
                    xr: [0, 5, "xr"], //向右走
                    zw: [6, 7, 'xl'], //转弯
                    xl: [7, 11, 'xl'], //向左走
                    stop: 0
                },
                framerate: 10
            };
            var oQq = Fn.CreateAniFame(oQqData);
            var qx = 250,
                qy = 820;
            oQq.set({
                x: qx,
                y: qy
            })


            var qStrt = 0;
            var zwStart = true;
            var menStart = true;


            //大楼
            var oWld = Create.cimg("wld");
            oWld.set({
                x: 240,
                y: 540
            });
            var louc = Create.cimg("louc");
            louc.set({
                x: 333,
                y: 745
            });

            //人群
            var oRu = Create.cimg("remqun");
            oRu.set({
                x: 400,
                y: 910
            });

            //汽车
            var oCar = Create.cimg("car");
            oCar.set({
                // x: 198, y: 1169
                x: 0,
                y: 1039
            });
            createjs.Tween.get(oCar)
                .wait(100)
                .to({
                    x: oCar.x + 210,
                    y: oCar.y + 130
                }, 10000, createjs.Ease.linear);
            var oJeep = Create.cimg("jeep");
            oJeep.set({
                x: 778,
                y: 890
            });
            createjs.Tween.get(oJeep)
                .wait(100)
                .to({
                    x: oJeep.x - 410,
                    y: oJeep.y + 280
                }, 12000, createjs.Ease.linear);

            page.addChild(oBg1, oCar, oJeep, oDlou, oMen, louc, oQq, oWld, oRu);

            //云
            function setYun() {
                var yunAttr = [{
                        x: 50,
                        y: 0,
                        row: 0
                    },
                    {
                        x: View.w - 40,
                        y: 50,
                        row: 180
                    },
                    {
                        x: View.w - 40,
                        y: View.h - 60,
                        row: 0
                    }
                ];
                yunAttr.forEach(function (val, i) {
                    var oYun = Create.cimg("yun");
                    oYun.set({
                        x: val.x,
                        y: val.y,
                        rotation: val.row
                    });
                    page.addChild(oYun);
                    var watime = _ll.tool.RandomNumBoth(0, 4);
                    createjs.Tween.get(oYun, {
                            loop: true
                        })
                        .wait(watime * 100)
                        .to({
                            scaleX: 1.1,
                            scaleY: 1.1
                        }, 2000, createjs.Ease.linear)
                        .to({
                            scaleX: 1,
                            scaleY: 1
                        }, 2000, createjs.Ease.linear);
                });
            }

            setYun();

            //红包
            function setHb() {
                var hbAttr = [{
                        type: 0,
                        x: 62,
                        y: 181,
                        size: 1
                    },
                    {
                        type: 1,
                        x: 348,
                        y: 58,
                        size: 0.6
                    },
                    {
                        type: 1,
                        x: 120.5,
                        y: 556,
                        size: 1
                    },
                    {
                        type: 0,
                        x: 434,
                        y: 449,
                        size: 1
                    },
                    {
                        type: 0,
                        x: 176,
                        y: 737,
                        size: 0.6
                    },
                    {
                        type: 1,
                        x: 423,
                        y: 656.5,
                        size: 0.4
                    },

                    {
                        type: 0,
                        x: 655,
                        y: 527,
                        size: 0.6
                    },
                    {
                        type: 0,
                        x: 483,
                        y: 731,
                        size: 0.3
                    },


                    {
                        type: 1,
                        x: 717,
                        y: 601,
                        size: 0.7
                    },
                    {
                        type: 0,
                        x: 690,
                        y: 949,
                        size: 0.4
                    }
                ];
                hbAttr.forEach(function (val, i) {
                    var oHb;
                    if (val.type === 0) {
                        oHb = Create.cimg("hbleft");
                        oHb.set({
                            x: val.x,
                            y: val.y,
                            scaleX: val.size,
                            scaleY: val.size
                        });
                    } else {
                        oHb = Create.cimg("hbright");
                        oHb.set({
                            x: val.x,
                            y: val.y,
                            scaleX: val.size,
                            scaleY: val.size
                        });
                    }
                    page.addChild(oHb);
                    var h = _ll.tool.RandomNumBoth(10, 30);
                    var watime = _ll.tool.RandomNumBoth(0, 4);
                    createjs.Tween.get(oHb, {
                            loop: true
                        })
                        .wait(watime * 100)
                        .to({
                            y: val.y + h
                        }, 2000, createjs.Ease.linear)
                        .to({
                            y: val.y
                        }, 2000, createjs.Ease.linear);
                });
            }

            setHb();


            //热气球
            var oRqx = Create.cimg("p1_box");
            oRqx.set({
                x: 194,
                y: 178
            });
            createjs.Tween.get(oRqx, {
                    loop: true
                })
                .to({
                    y: oRqx.y + 50
                }, 2000, createjs.Ease.linear)
                .to({
                    y: oRqx.y
                }, 2000, createjs.Ease.linear);
            page.addChild(oRqx);


            //qq运动
            function qqSports() {
                switch (qStrt) {
                    case 0:
                        qx++;
                        qy = qy - 0.5;
                        if (qx >= 355) {
                            qStrt = 1;
                        }
                        break;
                    case 1:
                        if (zwStart) {
                            oQq.gotoAndPlay("zw");
                            zwStart = false;
                        }
                        qx = qx - 0.5;
                        qy = qy - 0.4;
                        if (qx <= 352) {
                            qStrt = 2;
                        }
                        break;
                    case 2:
                        if (menStart) {
                            oMen.gotoAndPlay("move0");
                            menStart = false;
                        }
                        qx = qx - 0.5;
                        qy = qy - 0.4;
                        if (qx <= 270) {
                            qStrt = 3;
                        }
                        break;
                    case 3:
                        oQq.removeEventListener("tick", qqSports);
                        Page.to("p2");
                        break;
                }
                oQq.set({
                    x: qx,
                    y: qy
                });

            }

            var oPop = new createjs.Bitmap(Res.getResult("pop"));
            page.addChild(oPop);
            oPop.set({
                alpha: 0,
            });

            createjs.Tween.get(oPop)
                .wait(1000)
                .to({
                    alpha: 1
                }, 1000, createjs.Ease.quadOut)
                .call(function () {
                    createjs.Tween.get(oPop)
                        .wait(400)
                        .to({
                            alpha: 0
                        }, 700, createjs.Ease.quadOut)
                        .call(function () {
                            //企鹅运动
                            oQq.gotoAndPlay("xr");
                            oQq.addEventListener("tick", qqSports);
                        });
                });


            //###out
            page.out = function () {

            }
        },
        //大厅
        p2: function () {
            var page = this.page('p2');
            var oBg2 = new createjs.Bitmap(Res.getResult("bg_2"));

            //qq
            var oQqData2 = {
                images: [Res.getResult("p2_qq")],
                frames: {
                    width: 140, //每帧的宽度
                    height: 140, //每帧的高度
                },
                animations: {
                    start: 0,
                    runL: [0, 2, "runL"], //向左走
                    wave: [3, 5, "wave"], //挥手1
                    zsr: [6, 7, 'runR'], // 右转身
                    zsl: [6, 0, 'runL'], // 左转身
                    runR: [7, 9, "runR"],
                    wave2: [10, 22, "runL"], //挥手2
                    stop: 4
                },
                framerate: 10
            };
            var oQq2 = Fn.CreateAniFame(oQqData2);

            //前台招待
            var oDeskData = {
                images: [Res.getResult("p2_desk")],
                frames: {
                    width: 101, //每帧的宽度
                    height: 144, //每帧的高度
                },
                animations: {
                    start: 0,
                    yb: [0, 9, "yb"], //摇摆
                    wave: [10, 16, "start"], //挥手1
                },
                framerate: 10
            };
            var oDesk = Fn.CreateAniFame(oDeskData);
            oDesk.set({
                x: 160,
                y: 735
            });
            oDesk.gotoAndPlay("yb");

            //熊
            var oBearData = {
                images: [Res.getResult("p2_bear")],
                frames: {
                    // width: 130, //每帧的宽度
                    // height: 160, //每帧的高度
                    width: 178, //每帧的宽度
                    height: 230, //每帧的高度
                },
                animations: {
                    start: 0,
                    yb: [0, 6, "yb"], //摇摆

                    wave: [7, 13, "yb"], //挥手1
                },
                framerate: 10
            };
            var oBear = Fn.CreateAniFame(oBearData);
            oBear.set({
                // x: 570, y: 254
                x: 560,
                y: 190
            });
            oBear.gotoAndPlay("yb");
            //墙面
            var oOebi = new createjs.Bitmap(Res.getResult("cebi"));
            page.addChild(oBg2, oDesk, oBear, oQq2, oOebi);


            var qStrt = 0,
                qx = 700,
                qy = 1000;
            oQq2.set({
                x: qx,
                y: qy
            });
            var stateQ = false; //状态
            oQq2.gotoAndPlay("runL");


            var poolX = 3; //1
            var poolY = 2.3; //0.8
            //企鹅运动
            function run() {
                switch (qStrt) {
                    case 0:
                        qx = qx - poolX;
                        qy = qy - poolY;
                        if (qx === 508) {
                            qStrt = 1;
                            stateQ = true;
                        }
                        break;
                    case 1:
                        if (stateQ) {
                            //挥手
                            oQq2.gotoAndPlay("wave");
                            setTimeout(function () {
                                oQq2.gotoAndPlay("runL");
                            }, 1000);
                            oDesk.gotoAndPlay("wave");
                            stateQ = false;
                        }
                        qx = qx - poolX;
                        qy = qy - poolY;
                        if (qx === 304) {
                            qStrt = 2;
                            stateQ = true;
                        }
                        break;
                    case 2:

                        if (stateQ) {
                            //向右转弯
                            oQq2.gotoAndPlay("zsr");
                            stateQ = false;
                        }
                        qx = qx + poolX;
                        qy = qy - poolY;
                        if (qx >= 628 && qx <= 640) {
                            qStrt = 3;
                            stateQ = true;
                        }
                        break;
                    case 3:

                        if (stateQ) {
                            //左转弯
                            oQq2.gotoAndPlay("zsl");
                            stateQ = false;
                        }
                        qx = qx - poolX;
                        qy = qy - poolY;
                        if (qx <= 580 && qx >= 550) {

                            qStrt = 4;
                            stateQ = true;
                        }
                        break;

                    case 4:
                        if (stateQ) {
                            //企鹅挥手
                            oQq2.gotoAndPlay("wave2");
                            //熊挥手
                            oBear.gotoAndPlay("wave");
                            stateQ = false;

                            function qhcom() {

                                qStrt = 5;
                                oQq2.removeEventListener("animationend", qhcom)
                            }

                            oQq2.addEventListener("animationend", qhcom)
                        }
                        break;
                    case 5:
                        qx = qx - poolX;
                        qy = qy - poolY;
                        if (qx <= 200) {
                            oQq2.removeEventListener("tick", run);
                            //跳转
                            Page.to("p3");
                        }
                        break;
                }
                oQq2.set({
                    x: qx,
                    y: qy
                });

            }

            oQq2.addEventListener("tick", run);
        },
        //等待电梯
        p3: function () {
            var page = this.page('p3');
            //背景
            var oBg3 = new createjs.Bitmap(Res.getResult("bg_3"));
            //提示
            var oJt = Create.cimg("p3_jt");
            oJt.set({
                x: 228.5,
                y: 507.5 - 30
            });
            createjs.Tween.get(oJt, {
                    loop: true
                })
                .to({
                    y: oJt.y + 30
                }, 300, createjs.Ease.linear)
                .to({
                    y: oJt.y
                }, 300, createjs.Ease.linear);

            var oGq = Create.cimg("p3_gqx");
            oGq.set({
                x: 232,
                y: 572.5
            });
            createjs.Tween.get(oGq, {
                    loop: true
                })
                .to({
                    scaleX: 1.1,
                    scaleY: 1.1,
                    alpha: 0
                }, 400, createjs.Ease.quadOut)
                .to({
                    scaleX: 1,
                    scaleY: 1,
                    alpha: 1
                }, 400, createjs.Ease.quadOut);

            //按钮
            var obtn = new createjs.Shape();
            obtn.graphics.f('#000').dr(154, 497, 200, 200);
            obtn.alpha = 0.01;
            page.addChild(oBg3, oGq, oJt, obtn);

            //识别页面
            var disCon = new createjs.Container();
            disCon.alpha = 0;
            page.addChild(disCon);
            var oDiscern = new createjs.Bitmap(Res.getResult("discern"));
            disCon.addChild(oDiscern);

            var textObj = []; //文字对象
            //正在识别 字体动画
            function textShow() {
                var txAttr = [{
                        x: 369.5,
                        y: 884,
                        rx: 0
                    },
                    {
                        x: 440,
                        y: 884,
                        rx: 58
                    },
                    {
                        x: 530,
                        y: 884,
                        rx: 136
                    },
                    {
                        x: 605,
                        y: 884,
                        rx: 210
                    }
                ];
                txAttr.forEach(function (val, i) {
                    var text1 = Create.cimg("stext");
                    text1.set({
                        x: val.x,
                        y: val.y
                    });
                    var rect_1 = new createjs.Rectangle(val.rx, 0, 58, 54);
                    text1.sourceRect = rect_1;
                    disCon.addChild(text1);
                    textObj.push(text1);
                    text1.alpha = 0;
                });
                //文字动画
                var num = 0;

                var times = 0;

                function animtext() {
                    if (num < textObj.length) {

                        textObj[num].alpha = 1;
                        num++;
                    } else {
                        num = 0;
                        textObj.forEach(function (val) {
                            val.alpha = 0;
                        });
                        times++;
                        if (times > 1) {
                            clearInterval(tSime);


                            //识别成功
                            if (_g.isUser === 1) {

                                var oWg = Create.cimg("sb_wg");
                                oWg.set({
                                    x: 384.5,
                                    y: 455.5,
                                    alpha: 0
                                });
                                disCon.addChild(oWg);

                                var oSbsucc = Create.cimg("sb_succ");
                                oSbsucc.set({
                                    x: 382,
                                    y: 633,
                                    alpha: 0
                                });
                                var sbLast = Create.cimg("sb_last");
                                sbLast.set({
                                    x: 374,
                                    y: 1071,
                                    alpha: 0
                                });
                                disCon.addChild(oSbsucc, sbLast);

                                createjs.Tween.get(oWg)
                                    .to({
                                        alpha: 1
                                    }, 500, createjs.Ease.quadOut)
                                    .call(function () {
                                        createjs.Tween.get(oSbsucc)
                                            .to({
                                                alpha: 1
                                            }, 200, createjs.Ease.quadOut)
                                            .to({
                                                alpha: 0
                                            }, 200, createjs.Ease.quadOut)
                                            .to({
                                                alpha: 1
                                            }, 200, createjs.Ease.quadOut)
                                            .call(function () {
                                                //进入电梯
                                                createjs.Tween.get(sbLast)
                                                    .to({
                                                        alpha: 1
                                                    }, 1000, createjs.Ease.quadOut)
                                                    .call(function () {
                                                        //进入电梯
                                                        Page.to("p4");
                                                    })
                                            })
                                    });

                            } else {
                                //识别失败
                                var oSberr = new createjs.Bitmap(Res.getResult("sberr"));
                                oSberr.alpha = 0;
                                disCon.addChild(oSberr);
                                createjs.Tween.get(oSberr)
                                    .to({
                                        alpha: 1
                                    }, 500, createjs.Ease.quadOut);
                            }


                        }


                    }
                }

                var tSime = setInterval(animtext, 300);

            }

            //心电图
            function elect() {
                var mwX = 230; //限制容器的位置x
                var mwY = 730; //限制容器的位置y
                var mwMask = new createjs.Shape();
                mwMask.graphics.dr(mwX, mwY, 315, 80);
                var mWarp = new createjs.Container();
                mWarp.set({
                    x: mwX,
                    y: mwY
                });
                mWarp.mask = mwMask;

                var oBg32 = new createjs.Bitmap(Res.getResult("bg_3"));

                var oSlid = new createjs.Shape();
                oSlid.graphics.f('#64edd9').dr(0, 40, 315, 2);
                mWarp.addChild(oSlid);
                for (var i = 0; i < 6; i++) {
                    var oQx = Create.cimg("qx");
                    oQx.set({
                        x: 315 / 2 - 400,
                        y: 80 / 2
                    });
                    mWarp.addChild(oQx);
                    var size = _ll.tool.RandomNumBoth(170, 200);
                    var t = _ll.tool.RandomNumBoth(400, 800);

                    createjs.Tween.get(oQx, {
                            loop: true
                        })
                        .to({
                            scaleY: size / 100
                        }, t, createjs.Ease.quadOut)
                        .to({
                            scaleY: 1
                        }, t, createjs.Ease.quadOut);
                    createjs.Tween.get(oQx, {
                            loop: true
                        })
                        .wait(i * 1000)
                        .to({
                            x: oQx.x + 800
                        }, 6000, createjs.Ease.linear);
                    disCon.addChild(mWarp);
                }

            }

            elect();
            //事件
            obtn.on("click", function () {
                createjs.Tween.get(disCon)
                    .to({
                        alpha: 1
                    }, 1000, createjs.Ease.quadOut)
                    .call(function () {
                        textShow();
                    })
            });

        },
        //电梯里面
        p4: function () {
            var page = this.page('p4');
            //背景
            var oBg4 = new createjs.Bitmap(Res.getResult("bg_4"));
            page.addChild(oBg4);

            var oLian = Create.cimg("p4_btnlx");
            oLian.set({
                x: 537.5,
                y: 526.5
            });
            createjs.Tween.get(oLian, {
                    loop: true
                })
                .to({
                    alpha: 1
                }, 200, createjs.Ease.quadOut)
                .to({
                    alpha: 0
                }, 200, createjs.Ease.quadOut);


            var oHui1 = Create.cimg("p4_an_1");
            oHui1.set({
                x: 539,
                y: 397.5,
                alpha: 0
            });
            var oHui2 = Create.cimg("p4_an_2");
            oHui2.set({
                x: 538,
                y: 483.5,
                alpha: 0
            });
            var oHui3 = Create.cimg("p4_an_3");
            oHui3.set({
                x: 537,
                y: 569.5,
                alpha: 0
            });
            var oHui4 = Create.cimg("p4_an_4");
            oHui4.set({
                x: 536,
                y: 655.5,
                alpha: 0
            });

            _g.gameLv.forEach(function (val, i) {
                if (val === 1) {
                    switch (i) {
                        case 0:
                            oHui1.alpha = 1;
                            break;
                        case 1:
                            oHui2.alpha = 1;
                            break;
                        case 2:
                            oHui3.alpha = 1;
                            break;
                        case 3:
                            oHui4.alpha = 1;
                            break;
                    }
                }
            });

            page.addChild(oLian, oHui1, oHui2, oHui3, oHui4);
            //禄
            var obtn1 = new createjs.Shape();
            obtn1.graphics.f('#000').dr(490, 350, 100, 80);
            obtn1.alpha = 0.01;
            //寿
            var obtn2 = new createjs.Shape();
            obtn2.graphics.f('#000').dr(490, 440, 100, 80);
            obtn2.alpha = 0.01;
            //喜
            var obtn3 = new createjs.Shape();
            obtn3.graphics.f('#000').dr(490, 530, 100, 80);
            obtn3.alpha = 0.01;
            //财
            var obtn4 = new createjs.Shape();
            obtn4.graphics.f('#000').dr(490, 620, 100, 80);
            obtn4.alpha = 0.01;


            var ojtx = Create.cimg("p4_jtx");
            ojtx.set({
                x: 535,
                y: 783 + 30
            });
            createjs.Tween.get(ojtx, {
                    loop: true
                })
                .to({
                    y: ojtx.y - 30
                }, 400, createjs.Ease.linear)
                .to({
                    y: ojtx.y
                }, 400, createjs.Ease.linear);


            if (_g.pts4) {
                _g.pts4 = false;
                var oTs = Create.cimg("p4_ts");
                oTs.set({
                    x: 262,
                    y: 450
                });
                createjs.Tween.get(oTs, {
                        loop: true
                    })
                    .to({
                        scaleX: 1.1,
                        scaleY: 1.1,
                    }, 500, createjs.Ease.quadOut)
                    .to({
                        scaleX: 1,
                        scaleY: 1,
                    }, 500, createjs.Ease.quadOut);
                page.addChild(oTs);
            }
            page.addChild(ojtx, obtn1, obtn2, obtn3, obtn4);

            //事件
            obtn1.on("click", function () {
                Page.to("p5");
            });
            obtn2.on("click", function () {
                Page.to("p6");
            });
            obtn3.on("click", function () {
                Page.to("p7");
            });
            obtn4.on("click", function () {
                Page.to("p8");
            });


        },
        //禄-游戏
        p5: function () {
            var page = this.page('p5');
            var gdObj = {
                x: 286,
                y: 819,
                scaleX: 1.5,
                scaleY: 1.5
            };
            //播放视频
            Fn.payVideo(1, _g.vBox[0], function () {
                Fn.gameInit(gdObj, "game_bg_1", "game_bg_dh1", page, gameMian);
            });


            // Fn.gameInit(gdObj,"game_bg_1", "game_bg_dh1", page, gameMian);


            _g.gameLv[0] = 1;

            //游戏开始
            function gameMian() {
                var gameCon = new createjs.Container();
                gameCon.set({
                    x: View.w / 2,
                    y: View.h / 2,
                    regX: View.w / 2,
                    regY: View.h / 2,
                    alpha: 0
                });
                page.addChild(gameCon);
                gameCon.set({
                    scaleX: 1.5,
                    scaleY: 1.5
                });
                createjs.Tween.get(gameCon)
                    .to({
                        scaleX: 1,
                        scaleY: 1,
                        alpha: 1,
                    }, 600, createjs.Ease.quadOut);

                var oTmwk = Create.cimg("tmwk");
                oTmwk.set({
                    x: 375.5,
                    y: 609
                });
                //答案1 处女座
                var oTmbtn1 = Create.cimg("tmbtn_1");
                oTmbtn1.set({
                    x: 237.5,
                    y: 1019
                });
                //答案2 天蝎座
                var oTmbtn2 = Create.cimg("tmbtn_2");
                oTmbtn2.set({
                    x: 513.5,
                    y: 1019
                });


                //鸟人
                var oBird = Create.cimg("p5_bird");
                oBird.set({
                    x: 430,
                    y: 751
                });

                //鸟动作
                var oBirdDzData = {
                    images: [Res.getResult("p5_brid_sb")],
                    frames: {
                        width: 202, //每帧的宽度
                        height: 243, //每帧的高度
                    },
                    animations: {
                        start: 0,
                        run: [0, 2, "run"], //挥鞭
                    },
                    framerate: 5
                };
                var oBirdDz = Fn.CreateAniFame(oBirdDzData);
                oBirdDz.set({
                    x: 200,
                    y: 500
                });
                oBirdDz.gotoAndPlay("run");


                var oGameErr = Create.cimg("vgameerr");
                oGameErr.set({
                    x: 200,
                    y: 480,
                    regY: oGameErr.image.height,
                    regX: 0,
                    scaleX: 0,
                    scaleY: 0,
                    alpha: 0
                });

                gameCon.addChild(oTmwk, oBirdDz, oBird, oTmbtn1, oTmbtn2, oGameErr);


                var succYsObj = {
                    name: "succ_ys"
                };
                var tmObj = Fn.succAnime(gameCon, page, succYsObj);
                //事件

                //回答正确
                var btnstatr = true;
                oTmbtn1.on("click", function () {
                    if (!btnstatr) return;
                    btnstatr = false;
                    tmObj.init();
                    tmObj.start();
                    createjs.Tween.get(oTmbtn1)
                        .to({
                            scaleX: 0.8,
                            scaleY: 0.8
                        }, 100, createjs.Ease.quadOut)
                        .to({
                            scaleX: 1,
                            scaleY: 1
                        }, 100, createjs.Ease.quadOut)
                });
                oTmbtn2.on("click", function () {
                    if (!btnstatr) return;
                    btnstatr = false;
                    createjs.Tween.get(oTmbtn2)
                        .to({
                            scaleX: 0.8,
                            scaleY: 0.8
                        }, 100, createjs.Ease.quadOut)
                        .to({
                            scaleX: 1,
                            scaleY: 1
                        }, 100, createjs.Ease.quadOut)

                    createjs.Tween.get(oGameErr)
                        .to({
                            scaleX: 1,
                            scaleY: 1,
                            alpha: 1,
                        }, 600, createjs.Ease.quadOut)
                        .call(function () {
                            createjs.Tween.get(oGameErr)
                                .wait(200)
                                .to({
                                    alpha: 0,
                                }, 600, createjs.Ease.quadOut)
                                .call(function () {
                                    oGameErr.set({
                                        scaleX: 0,
                                        scaleY: 0,
                                        alpha: 0
                                    });
                                    btnstatr = true;
                                })
                        })
                });
            }


        },
        //寿 熊跑步
        p6: function () {
            var page = this.page('p6');
            var gdObj = {
                x: 250,
                y: 785
            };
            Fn.payVideo(2, _g.vBox[1], function () {
                Fn.gameInit(gdObj, "game_bg_2", "game_bg_dh2", page, gameMian);
            });

            // Fn.gameInit(gdObj, "game_bg_2", "game_bg_dh2", page, gameMian);
            _g.gameLv[1] = 1;

            function gameMian() {
                var gameCon = new createjs.Container();
                gameCon.set({
                    x: View.w / 2,
                    y: View.h / 2,
                    regX: View.w / 2,
                    regY: View.h / 2,
                    alpha: 0
                });
                page.addChild(gameCon);
                gameCon.set({
                    scaleX: 1.5,
                    scaleY: 1.5
                });
                createjs.Tween.get(gameCon)
                    .to({
                        scaleX: 1,
                        scaleY: 1,
                        alpha: 1,
                    }, 600, createjs.Ease.quadOut);


                var oTmwk = Create.cimg("tmwk_2");
                oTmwk.set({
                    x: 375.5,
                    y: 609
                });


                gameCon.addChild(oTmwk);

                //熊
                var oBearData = {
                    images: [Res.getResult("sxion")],
                    frames: {
                        width: 255, //每帧的宽度
                        height: 390, //每帧的高度
                    },
                    animations: {
                        start: 0,
                        run: [0, 2, "run"], //运动
                    },
                    framerate: 10
                };
                var oBear = Fn.CreateAniFame(oBearData);
                oBear.set({
                    x: 150,
                    y: 274
                });

                //左
                var oTmbtn1 = Create.cimg("game2Btn_1");

                oTmbtn1.set({
                    x: 150,
                    y: 780
                });
                //右
                var oTmbtn2 = Create.cimg("game2Btn_2");
                oTmbtn2.set({
                    x: 420,
                    y: 780
                });


                var clickNum = 0; //点击次数

                function gameObj(call, comle) {
                    var _this = this;
                    var mwX = 90; //限制容器的位置x
                    var mwY = 250; //限制容器的位置y
                    var mwMask = new createjs.Shape();
                    mwMask.graphics.dr(mwX, mwY, 570, 868);
                    var mWarp = new createjs.Container();
                    mWarp.set({
                        x: mwX,
                        y: mwY
                    });
                    mWarp.mask = mwMask;
                    gameCon.addChild(mWarp);
                    //红包金币
                    var oHbjb = Create.cimg("hbjb");
                    var size = 0.4;
                    oHbjb.set({
                        x: 280,
                        y: 200,
                        regX: oHbjb.image.width / 2,
                        regY: 0,
                        scaleY: size,
                        scaleX: size
                    });
                    var oHbjb2 = Create.cimg("hbjb");
                    var size2 = 0.4;
                    oHbjb2.set({
                        x: 280,
                        y: 200,
                        regX: oHbjb.image.width / 2,
                        regY: 0,
                        scaleY: size2,
                        scaleX: size2,
                        alpha: 0
                    });
                    //终点
                    var oZd = Create.cimg("zd");
                    var oZdSize = 0.3;
                    oZd.set({
                        x: 285,
                        y: 170,
                        regX: oZd.image.width / 2,
                        regY: 0,
                        scaleY: oZdSize,
                        scaleX: oZdSize
                    });

                    //能量条
                    var oLnt = Create.cimg("nlt");
                    oLnt.set({
                        x: 285,
                        y: 80
                    });
                    var oLntCon = Create.cimg("jdtn");
                    var oLntConSize = 0;
                    oLntCon.set({
                        x: 130,
                        y: 58,
                        scaleX: 0,
                        regX: 0,
                        regY: 0
                    });
                    mWarp.addChild(oHbjb, oHbjb2, oZd, oLntCon, oLnt);
                    mWarp.addChild(oTmbtn1, oTmbtn2, oBear);
                    var sh = false; //第二个红包状态
                    //红包金币效果

                    var zNum = 0;

                    function hbRun() {
                        if (size > 2.6) {
                            size = 0.4;
                            oHbjb.set({
                                scaleY: size,
                                scaleX: size
                            });
                        } else {
                            size = size + 0.01;
                            oHbjb.set({
                                scaleY: size,
                                scaleX: size
                            });
                        }
                        if (size >= 1.3) {
                            sh = true;
                        }
                        if (sh) {
                            if (size2 > 2.6) {
                                size2 = 0.4;
                                oHbjb2.set({
                                    scaleY: size2,
                                    scaleX: size2,
                                });
                            } else {
                                size2 = size2 + 0.01;
                                oHbjb2.set({
                                    scaleY: size2,
                                    scaleX: size2,
                                    alpha: 1
                                });
                            }
                        }
                        // 结束
                        zNum++;



                        if (zNum >= clickNum * 40) {
                            _this.sotp();

                            if (call) call();
                            // return;
                        }

                        if (zNum >= 400) {
                            _this.sotp();
                            if (comle) comle();
                            return;
                        }
                        if (zNum >= 200) {
                            if (zNum >= 300) {
                                oZdSize = oZdSize + 0.006;
                            } else {
                                oZdSize = oZdSize + 0.004;
                            }
                        } else {
                            oZdSize = oZdSize + 0.001;
                        }
                        oZd.set({
                            scaleY: oZdSize,
                            scaleX: oZdSize
                        });
                        oLntCon.set({
                            scaleX: 0.0025 * zNum
                        });


                    }


                    this.start = function () {
                        mWarp.addEventListener("tick", hbRun);

                    };
                    //停止
                    this.sotp = function () {
                        mWarp.removeEventListener("tick", hbRun);
                    };

                    this.destination = function (comle) {
                        if (sh) {


                        }

                    }

                }


                var btnstatr = true;
                var startTime = 0;
                //游戏提示
                var oTs = Create.cimg("p6_ts");
                oTs.set({
                    x: 455,
                    y: 437,
                    alpha: 0
                });
                createjs.Tween.get(oTs)
                    .wait(300)
                    .to({
                        alpha: 1,
                    }, 600, createjs.Ease.quadOut)
                    .call(function () {
                        createjs.Tween.get(oTs, {
                                loop: true
                            })
                            .to({
                                scaleX: 1.1,
                                scaleY: 1.1,
                            }, 200, createjs.Ease.quadOut)
                            .to({
                                scaleX: 1,
                                scaleY: 1,
                            }, 200, createjs.Ease.quadOut);
                        setTimeout(function () {
                            createjs.Tween.get(oTs)
                                .to({
                                    alpha: 0
                                }, 600, createjs.Ease.quadOut)
                                .call(function () {
                                    page.removeChild(oTs)
                                })
                        }, 1000);
                    });


                page.addChild(oTs);

                //游戏运动
                var games = new gameObj(function () {
                    oBear.gotoAndPlay("start");
                    btnstatr = true;
                }, function () {
                    //游戏结束
                    clearInterval(clickSotp);
                    oBear.gotoAndPlay("start");
                    btnstatr = false;
                    tmObj.init();
                    tmObj.start();
                });
                //游戏成功
                var succYsObj = {
                    name: "succ_ys_2",
                    y: 317
                };
                var tmObj = Fn.succAnime(gameCon, page, succYsObj);


                //事件
                var clickSotp = setInterval(function () {
                    // startTime++;
                    // if (startTime > 5) {
                    //     //长时间不按按钮停止
                    //     games.sotp();
                    //     oBear.gotoAndPlay("start");
                    //     btnstatr = true;
                    // }
                }, 100);
                oTmbtn1.on("click", function () {
                    if (btnstatr) {
                        btnstatr = false;
                        oBear.gotoAndPlay("run");
                        games.start();
                    }
                    startTime = 0;
                    if (clickNum < 10) {
                        clickNum++;
                        createjs.Tween.get(oTmbtn1)
                            .to({
                                scaleX: 0.8,
                                scaleY: 0.8
                            }, 100, createjs.Ease.quadOut)
                            .to({
                                scaleX: 1,
                                scaleY: 1
                            }, 100, createjs.Ease.quadOut)
                    }
                });
                oTmbtn2.on("click", function () {
                    if (btnstatr) {
                        btnstatr = false;
                        oBear.gotoAndPlay("run");
                        games.start();
                    }
                    startTime = 0;
                    if (clickNum < 10) {
                        clickNum++;
                        createjs.Tween.get(oTmbtn2)
                            .to({
                                scaleX: 0.8,
                                scaleY: 0.8
                            }, 100, createjs.Ease.quadOut)
                            .to({
                                scaleX: 1,
                                scaleY: 1
                            }, 100, createjs.Ease.quadOut)
                    }
                });
            }
        },
        //喜-欣“喜”雀乐
        p7: function () {
            var page = this.page('p7');
            var tmMusic;
            var gdObj = {
                x: 223,
                y: 786,
            };
            Fn.payVideo(3, _g.vBox[2], function () {
                Fn.gameInit(gdObj, "game_bg_3", "game_bg_dh3", page, gameMian);
            });

            // Fn.gameInit(gdObj,"game_bg_3", "game_bg_dh3", page, gameMian);
            _g.gameLv[2] = 1;

            function gameMian() {
                var gameCon = new createjs.Container();
                gameCon.set({
                    x: View.w / 2,
                    y: View.h / 2,
                    regX: View.w / 2,
                    regY: View.h / 2,
                    alpha: 0
                });
                page.addChild(gameCon);
                gameCon.set({
                    scaleX: 1.5,
                    scaleY: 1.5
                });
                createjs.Tween.get(gameCon)
                    .to({
                        scaleX: 1,
                        scaleY: 1,
                        alpha: 1,
                    }, 600, createjs.Ease.quadOut);


                //外框
                var oTmwk = Create.cimg("tmwk_3");
                oTmwk.set({
                    x: 375.5,
                    y: 609
                });

                //播放题目音乐

                setTimeout(function () {
                    // var tmMusic=null;  //把这变量放在全局
                    //播放
                    tmMusic = createjs.Sound.play("tm", {
                        loop: -1
                    });
                    //停止播放
                    // tmMusic.stop();

                   
                    $('#media')[0].pause();
                }, 800);


                //答案1 这一刻爱吧
                // var oTmbtn1 = new createjs.Shape();
                // oTmbtn1.graphics.f('#000').dr(120, 980, 229, 106);
                // oTmbtn1.alpha = 0.01;
                // //答案2 这一秒爱
                // var oTmbtn2 = new createjs.Shape();
                // oTmbtn2.graphics.f('#000').dr(400, 980, 229, 106);
                // oTmbtn2.alpha = 0.01;
                // gameCon.addChild(oTmwk, oTmbtn1, oTmbtn2);


                //答案1
                var oTmbtn1 = Create.cimg("p7_da_1");
                oTmbtn1.set({
                    x: 237.5,
                    y: 1039
                });
                //答案2
                var oTmbtn2 = Create.cimg("p7_da_2");
                oTmbtn2.set({
                    x: 513.5,
                    y: 1039
                });
                gameCon.addChild(oTmwk, oTmbtn1, oTmbtn2);

                //圆光
                function yunsBox() {
                    var ogl1 = Create.cimg("gl_1");
                    ogl1.set({
                        x: 375,
                        y: 549.5
                    });
                    ogl1.alpha = 0;
                    var ogl2 = Create.cimg("gl_2");
                    ogl2.set({
                        x: 375,
                        y: 529
                    });
                    var glStart = true;

                    function flicker() {
                        if (glStart) {
                            ogl1.alpha = 0;
                            ogl2.alpha = 1;
                        } else {
                            ogl1.alpha = 1;
                            ogl2.alpha = 0;
                        }
                        glStart = !glStart;
                    }

                    setInterval(flicker, 200);
                    gameCon.addChild(ogl1, ogl2);

                }

                yunsBox();

                //神灯
                function sD() {
                    var oSend1 = Create.cimg("send_1");
                    oSend1.set({
                        x: 100,
                        y: 300,
                        regX: 0,
                        regY: 0
                    });
                    var oSend2 = Create.cimg("send_2");
                    oSend2.set({
                        x: 650,
                        y: 300,
                        regX: oSend2.image.width,
                        regY: 0
                    });
                    gameCon.addChild(oSend1, oSend2);
                    createjs.Tween.get(oSend1, {
                            loop: true
                        })
                        .to({
                            rotation: -5
                        }, 1000, createjs.Ease.quadOut)
                        .to({
                            rotation: 5
                        }, 1000, createjs.Ease.quadOut);
                    createjs.Tween.get(oSend2, {
                            loop: true
                        })

                        .to({
                            rotation: -5
                        }, 1000, createjs.Ease.quadOut)
                        .to({
                            rotation: 5
                        }, 1000, createjs.Ease.quadOut);
                }

                sD();

                //喇叭
                function laba() {
                    var qmiv = [{
                            x: 202.5,
                            y: 815.5,
                            size: 1,
                        },
                        {
                            x: 192,
                            y: 762,
                            size: 0.7
                        },
                        {
                            x: 553.5,
                            y: 810.5,
                            size: 1
                        },
                        {
                            x: 563,
                            y: 754,
                            size: 0.7
                        }
                    ];
                    var oLaba = Create.cimg("laba");
                    oLaba.set({
                        x: 378,
                        y: 784
                    });
                    gameCon.addChild(oLaba);

                    qmiv.forEach(function (val) {
                        var pQqM = Create.cimg("qqmicu");
                        pQqM.set({
                            x: val.x,
                            y: val.y,
                            scaleY: val.size,
                            scaleX: val.size
                        });
                        createjs.Tween.get(pQqM, {
                                loop: true
                            })
                            .to({
                                scaleY: pQqM.scaleY + 0.2,
                                scaleX: pQqM.scaleX + 0.2
                            }, 200, createjs.Ease.quadOut)
                            .to({
                                scaleY: pQqM.scaleY,
                                scaleX: pQqM.scaleX
                            }, 200, createjs.Ease.quadOut);
                        gameCon.addChild(pQqM);
                    });


                }

                laba();

                //鸟
                function bird() {
                    //熊
                    var oBirdData = {
                        images: [Res.getResult("bird")],
                        frames: {
                            width: 446, //每帧的宽度
                            height: 409, //每帧的高度
                        },
                        animations: {
                            start: 0,
                            yb: [0, 5, "yb"], //dong
                        },
                        framerate: 5
                    };
                    var oBird = Fn.CreateAniFame(oBirdData);
                    oBird.set({
                        x: 150,
                        y: 440
                    });
                    gameCon.addChild(oBird);
                    oBird.gotoAndPlay("yb");
                }

                bird();

                //音符
                function yfBox() {
                    var oYf = Create.cimg("yf");
                    oYf.set({
                        x: 444,
                        y: 408,
                        alpha: 0
                    });
                    var oYf2 = Create.cimg("yf");
                    oYf2.set({
                        x: 444,
                        y: 408,
                        alpha: 0
                    });
                    gameCon.addChild(oYf, oYf2);
                    createjs.Tween.get(oYf, {
                            loop: true
                        }).to({
                            alpha: 1
                        }, 100, createjs.Ease.quadOut)
                        .to({
                            scaleY: 1.3,
                            x: oYf.x + 50,
                            alpha: 0
                        }, 2000, createjs.Ease.quadOut);
                    createjs.Tween.get(oYf2, {
                            loop: true
                        })
                        .wait(1050)
                        .to({
                            alpha: 1
                        }, 100, createjs.Ease.quadOut)
                        .to({
                            scaleY: 1.3,
                            x: oYf2.x + 50,
                            alpha: 0
                        }, 2000, createjs.Ease.quadOut)

                }

                yfBox();
                var oGameTs = Create.cimg("xSm");
                oGameTs.set({
                    x: 200,
                    y: 400,
                    regY: oGameTs.image.height,
                    regX: 0,
                    // scaleX: 0,
                    // scaleY: 0,
                    // alpha: 0
                });
                var oGameErr = Create.cimg("xerr");
                oGameErr.set({
                    x: 250,
                    y: 420,
                    regY: oGameErr.image.height,
                    regX: 0,
                    scaleX: 0,
                    scaleY: 0,
                    alpha: 0
                });
                gameCon.addChild(oGameTs, oGameErr);
                var succYsObj = {
                    name: "succ_ys_3"
                };
                var tmObj = Fn.succAnime(gameCon, page, succYsObj);
                //事件
                //回答正确
                var btnstatr = true;
                oTmbtn1.on("click", function () {
                    if (!btnstatr) return;
                    btnstatr = false;
                    tmObj.init();
                    tmObj.start();


                    createjs.Tween.get(oTmbtn1)
                        .to({
                            scaleX: 0.8,
                            scaleY: 0.8
                        }, 100, createjs.Ease.quadOut)
                        .to({
                            scaleX: 1,
                            scaleY: 1
                        }, 100, createjs.Ease.quadOut)

                });
                oTmbtn2.on("click", function () {
                    if (!btnstatr) return;
                    // _ll.hint("回答错误");


                    createjs.Tween.get(oTmbtn2)
                        .to({
                            scaleX: 0.8,
                            scaleY: 0.8
                        }, 100, createjs.Ease.quadOut)
                        .to({
                            scaleX: 1,
                            scaleY: 1
                        }, 100, createjs.Ease.quadOut)

                    btnstatr = false;
                    oGameTs
                    createjs.Tween.get(oGameTs)
                        .to({
                            alpha: 0,
                        }, 200, createjs.Ease.quadOut)
                        .call(function () {
                            oGameTs.set({
                                scaleX: 0,
                                scaleY: 0,
                                alpha: 0
                            });
                        });
                    createjs.Tween.get(oGameErr)
                        .to({
                            scaleX: 1,
                            scaleY: 1,
                            alpha: 1,
                        }, 600, createjs.Ease.quadOut)
                        .call(function () {
                            createjs.Tween.get(oGameErr)
                                .wait(200)
                                .to({
                                    alpha: 0,
                                }, 600, createjs.Ease.quadOut)
                                .call(function () {
                                    oGameErr.set({
                                        scaleX: 0,
                                        scaleY: 0,
                                        alpha: 0
                                    });
                                    createjs.Tween.get(oGameTs)
                                        .to({
                                            scaleX: 1,
                                            scaleY: 1,
                                            alpha: 1,
                                        }, 600, createjs.Ease.quadOut)
                                        .call(function () {
                                            btnstatr = true;
                                        })

                                })
                        })
                });
            }
            //###out
            page.out = function () {
                //音乐停止
                tmMusic.stop();
                setTimeout(function () {
                    $('#media')[0].play();
                }, 500);
            }
        },
        //财-“财”运滚滚
        p8: function () {
            var page = this.page('p8');
            var gdObj = {
                x: 259,
                y: 814,
                scaleX: 1.2,
                scaleY: 1.2
            };
            Fn.payVideo(4, _g.vBox[3], function () {
                Fn.gameInit(gdObj, "game_bg_4", "game_bg_dh4", page, gameMian);
            });

            // Fn.gameInit(gdObj,"game_bg_4", "game_bg_dh4", page, gameMian);
            _g.gameLv[3] = 1;

            function gameMian() {
                var gameCon = new createjs.Container();
                gameCon.set({
                    x: View.w / 2,
                    y: View.h / 2,
                    regX: View.w / 2,
                    regY: View.h / 2,
                    alpha: 0
                });
                page.addChild(gameCon);
                gameCon.set({
                    scaleX: 1.5,
                    scaleY: 1.5
                });
                createjs.Tween.get(gameCon)
                    .to({
                        scaleX: 1,
                        scaleY: 1,
                        alpha: 1,
                    }, 600, createjs.Ease.quadOut);

                //外框
                var oTmwk = Create.cimg("tmwk_4");
                oTmwk.set({
                    x: 375.5,
                    y: 609
                });

                gameCon.addChild(oTmwk);


                function gdLh() {
                    var gdAtr = [{
                            x: 170,
                            y: 321
                        },
                        {
                            x: 245,
                            y: 315
                        },
                        {
                            x: 317,
                            y: 316
                        },
                        {
                            x: 386,
                            y: 315
                        },
                        {
                            x: 450,
                            y: 316
                        },
                        {
                            x: 520,
                            y: 315
                        },
                        {
                            x: 585,
                            y: 324
                        },
                        {
                            x: 592,
                            y: 404
                        },
                        {
                            x: 592,
                            y: 478
                        },

                        {
                            x: 592,
                            y: 551
                        },
                        {
                            x: 588,
                            y: 618
                        },
                        {
                            x: 519,
                            y: 626
                        },
                        {
                            x: 447,
                            y: 627
                        },
                        {
                            x: 387,
                            y: 626
                        },
                        {
                            x: 316,
                            y: 626
                        },
                        {
                            x: 244,
                            y: 626
                        },
                        {
                            x: 169,
                            y: 618
                        },
                        {
                            x: 166,
                            y: 550
                        },
                        {
                            x: 167,
                            y: 476
                        },
                        {
                            x: 166,
                            y: 401
                        },
                    ];
                    var oGd = [];
                    var obj = {};
                    gdAtr.forEach(function (val) {
                        var p8_dd = Create.cimg("p8_dd");
                        p8_dd.set({
                            x: val.x,
                            y: val.y,
                            alpha: 0
                        });
                        gameCon.addChild(p8_dd);
                        oGd.push(p8_dd);
                    });

                    var setIme = null;
                    var setIme2 = null;
                    var i = 0;

                    function aimes() {
                        if (i < oGd.length - 1) {
                            i++;
                        } else {
                            i = 0;
                        }
                        oGd.forEach(function (val) {
                            val.alpha = 0;
                        });
                        oGd[i].alpha = 1;
                    }

                    obj.start = function () {
                        setIme = setInterval(aimes, 100)
                    }
                    var allSx = 0;

                    function allAime() {
                        allSx++;
                        if (allSx % 2 == 1) {
                            oGd.forEach(function (val) {
                                val.alpha = 0;
                            });
                        } else {
                            oGd.forEach(function (val) {
                                val.alpha = 1;
                            });
                        }
                        if (allSx > 5) {
                            clearInterval(setIme2);
                        }
                    }

                    obj.pack = function () {
                        allSx = 0;
                        setIme2 = setInterval(allAime, 100);
                    }

                    obj.stop = function () {
                        clearInterval(setIme);
                    }
                    return obj;
                }

                var gx = new gdLh();

                //老虎机satrt
                var oLhj = Fn.lhj();
                //按钮
                var obtn = new createjs.Shape();
                obtn.graphics.f('#000').dr(240, View.h / 2 + 150, 270, 90);
                obtn.alpha = 0.01;
                //错误
                var oErr = Create.cimg("cErr");
                oErr.set({
                    x: 375,
                    y: 706,
                    alpha: 0
                });

                gameCon.addChild(oLhj.lhjCon, oErr, obtn);
                //红包容器
                var hbCon = new createjs.Container();
                gameCon.addChild(hbCon);
                var succYsObj = {
                    name: "succ_ys_4",
                    y: 275
                };
                var tmObj = Fn.succAnime(gameCon, page, succYsObj);
                var btnSz = true;
                obtn.on("click", function () {
                    if (!btnSz) return;
                    btnSz = false;
                    oLhj.init();
                    gx.start();

                    oLhj.start(function (isNot) {
                        gx.stop();
                        if (isNot === 1) {
                            //中奖
                            packet();

                        } else {
                            btnSz = true;
                            createjs.Tween.get(oErr)
                                .to({
                                    alpha: 1
                                }, 600, createjs.Ease.quadInOut)
                                .call(function () {
                                    createjs.Tween.get(oErr)
                                        .wait(500)
                                        .to({
                                            alpha: 0
                                        }, 600, createjs.Ease.quadInOut)
                                })
                        }

                    });

                });
                //老虎机end


                //事件

                function packet() {
                    gx.pack();
                    var p8_hb = Create.cimg("p8_hb");
                    p8_hb.set({
                        x: 375,
                        y: 944,
                        scaleY: 0,
                        scaleX: 0
                    });
                    hbCon.addChild(p8_hb);
                    createjs.Tween.get(p8_hb)
                        .to({
                            scaleY: 1,
                            scaleX: 1
                        }, 1000, createjs.Ease.quadOut)
                        .call(function () {

                            tmObj.init();
                            tmObj.start();
                        });


                }
            }
        },
        //9-五福齐聚
        p9: function () {
            var page = this.page('p9');
            var oBg9 = new createjs.Bitmap(Res.getResult("bg_9"));



            //1
            var oRemData1 = {
                images: [Res.getResult("p9_ren_1")],
                frames: {
                    width: 352, //每帧的宽度
                    height: 334, //每帧的高度
                },
                animations: {
                    start: 0,
                    run: [0, 1, "run"]
                },
                framerate: 6
            };
            var oRem1 = Fn.CreateAniFame(oRemData1);
            oRem1.set({
                x: 30,
                y: 310,
            });
            //2
            var oRemData2 = {
                images: [Res.getResult("p9_ren_2")],
                frames: {
                    width: 380, //每帧的宽度
                    height: 360, //每帧的高度
                },
                animations: {
                    start: 0,
                    run: [0, 1, "run"]
                },
                framerate: 6
            };
            var oRem2 = Fn.CreateAniFame(oRemData2);
            oRem2.set({
                x: 360,
                y: 300,
            });

            //3
            var oRemData3 = {
                images: [Res.getResult("p9_ren_3")],
                frames: {
                    width: 197, //每帧的宽度
                    height: 327, //每帧的高度
                },
                animations: {
                    start: 0,
                    run: [0, 1, "run"]
                },
                framerate: 6
            };
            var oRem3 = Fn.CreateAniFame(oRemData3);
            oRem3.set({
                x: 80,
                y: 510,
            });

            //4
            var oRemData4 = {
                images: [Res.getResult("p9_ren_4")],
                frames: {
                    width: 230, //每帧的宽度
                    height: 306, //每帧的高度
                },
                animations: {
                    start: 0,
                    run: [0, 1, "run"]
                },
                framerate: 6
            };
            var oRem4 = Fn.CreateAniFame(oRemData4);
            oRem4.set({
                x: 460,
                y: 534,
            });


            //5
            var oRemData5 = {
                images: [Res.getResult("p9_ren_5")],
                frames: {
                    width: 423, //每帧的宽度
                    height: 440, //每帧的高度
                },
                animations: {
                    start: 0,
                    run: [0, 4, "run"]
                },
                framerate: 6
            };
            var oRem5 = Fn.CreateAniFame(oRemData5);
            oRem5.set({
                x: 170,
                y: 450,
            });

            var oBtn = Create.cimg("p9_btn");
            oBtn.set({
                x: 380,
                y: 382,
            });

            var obtnBox = new createjs.Shape();
            obtnBox.graphics.f('#000').dr(200, 320, 300, 300);
            obtnBox.alpha = 0.01;
            page.addChild(oBg9, oRem1, oRem2, oRem3, oRem4, oRem5, oBtn, obtnBox);


            var oConp = new createjs.Container();
            page.addChild(oConp);
            var oBott = Create.cimg("p9_bottom");
            oBott.set({
                x: 376,
                y: 999
            });
            var yjText = '';
            if (_g.isGetMoney === 1) {
                yjText = '您已领过该红包啦~';
            }

            var oYj = new createjs.Text(yjText, "60px Microsoft YaHei", "#ffffff");
            oYj.set({
                textAlign: "center",
                textBaseline: "middle",
                x: 376,
                y: 1000
            });
            var oTexts = new createjs.Text(_g.money + "元", "100px Microsoft YaHei", "#f8ce9a");
            oTexts.set({
                textAlign: "center",
                textBaseline: "middle",
                x: 376,
                y: 1110
            });
            oConp.addChild(oBott, oYj, oTexts);

            obtnBox.on("click", function () {
                oBtn.alpha = 0;
                oRem1.gotoAndPlay("run");
                oRem2.gotoAndPlay("run");
                oRem3.gotoAndPlay("run");
                oRem4.gotoAndPlay("run");
                oRem5.gotoAndPlay("run");

                createjs.Tween.get(oConp)
                    .to({
                        y: oConp.y + 400,
                        alpha: 0
                    }, 700, createjs.Ease.quadOut);

                _g.isGetMoney = 1;

                $('#media')[0].pause();
                wfMusic = createjs.Sound.play("wufu", {
                    loop: -1
                });
                setTimeout(function () {
                    Page.to("p10");
                }, 5000);
            });



            //###out
            page.out = function () {

            }
        },
        //10分享页
        p10: function () {
            var page = this.page('p10');
            var oBg10 = new createjs.Bitmap(Res.getResult("bg_10"));

            var oShareBtn = Create.cimg("shareBtn");
            oShareBtn.set({
                x: 212,
                y: 932
            });
            var oJxBtn = Create.cimg("jxBtn");
            oJxBtn.set({
                x: 526,
                y: 932
            });


            page.addChild(oBg10, oShareBtn, oJxBtn);


            oShareBtn.on("click", function () {
                $(".share_pop").moveIn();
            });
            oJxBtn.on("click", function () {
                Page.to("p4");

                wfMusic.stop();
                setTimeout(function () {
                    $('#media')[0].play();
                }, 500);
            });
        },

    };

    function Init(complete) {
        //数据初始化
        // $.ajax({
        //     type: "POST",
        //     url: "Common/init.aspx",
        //     dataType: "json",
        //     beforeSend: function () {},
        //     success: function (data) {
        //         if (data.status === 1 || data.status === -5) {

        //         } else {
        //             _ll.hint("数据错误");
        //         }
        //     },
        //     complete: function () {}
        // });

        if (complete) complete();
    }

    function Main() {
        Size();
        Canvas.width = View.w;
        Canvas.height = View.h;
        Stage = new createjs.Stage(Canvas);
        createjs.Touch.enable(Stage);
        createjs.Ticker.timingMode = createjs.Ticker.RAF;
        createjs.Ticker.addEventListener("tick", Tick);

        Fn.loadingImg(function () {
            Page.to('load');
            Init(function () {
                Load(function () {
                    $('#js_musicBtn').show();
                    // Page.to('p4');
                    _ll.delayImg(); //延迟加载图片

                });
            });
        });


        $(".share_pop").on(xxEvents.start, function () {
            $(".share_pop").moveOut();
        });





    }

    //接口
    _g.main = Main;
})();
_ll.main = function () {
    _g.main();
}